You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: controller.rb
    path of file: ./repos/airplayer/lib/airplayer
    
    the code of the file until where you have to start completion: require 'ruby-progressbar'

module AirPlayer
  class Controller
    def initialize(options = { device: nil })
      @device      = Device.get(options[:device])
      @player      = nil
      @progressbar = nil
    end

    def play(media)
      puts " Source: #{media.path}"
      puts "  Title: #{media.title}"
      puts 
    
    def play(media)
      puts " Source: #{media.path}"
      puts "  Title: #{media.title}"
      puts " Device: #{@device.name} (Resolution: #{@device.info.resolution})"

      @progressbar = ProgressBar.create(format: '   %a |%b%i| %p%% %t')
      @player = @device.play(media.path)
      @player.progress -> playback {
        @progressbar.title    = 'Streaming'
        @progressbar.progress = playback.percent if playback.percent
      }
      @player.wait
    end