title: How to show buffer progress on AVPlayer?
body: <p>I have a music player application that allow user to stream song from server. I've been able to stream song from url using AVPlayer. I want to achieve something like below:</p>
  
  <p><img src="https://i.stack.imgur.com/vvghv.png" alt="enter image description here"></p>
  
  <p>I've tried to convert top answer from this <a href="https://stackoverflow.com/questions/3999228/how-to-get-file-size-and-current-file-size-from-nsurl-for-avplayer-ios4-0">How to get file size and current file size from NSURL for AVPlayer iOS4.0</a> post to swift, but I can't find the "kLoadedTimeRanges".</p>
  
  <p>And here is my code: </p>
  
  <pre><code>override func observeValueForKeyPath(keyPath: String, ofObject object: AnyObject, change: [NSObject : AnyObject], context: UnsafeMutablePointer&lt;Void&gt;) {
  
      if object as? NSObject == songPlayer &amp;&amp; keyPath == "status" {
  
          if songPlayer?.status == AVPlayerStatus.Failed {
  
              println("AVPlayerStatusReadyToFailed")
  
          }else if songPlayer?.status == AVPlayerStatus.ReadyToPlay {
  
              println("AVPlayerStatusReadyToPlay")
              self.songPlayer!.play()
  
          }else if songPlayer?.status == AVPlayerStatus.Unknown {
  
              println("AVPlayerStatusReadyToUnknown")
  
          }
  
      }
  }
  
  @IBAction func playAction(sender: UIButton) {
  
      var songUrl = "http://a575.phobos.apple.com/us/r1000/119/Music/v4/67/9d/b0/679db0ba-a7f4-35ea-3bf1-e817e7bcf11f/mzaf_3227008615944938675.aac.m4a"
      var songPlayerItem = self.songPlayer?.currentItem
      self.songPlayer = AVPlayer(URL: NSURL(string: songUrl))
      NSNotificationCenter.defaultCenter().addObserver(self, selector: "playerItemDidReachEnd:", name: AVPlayerItemDidPlayToEndTimeNotification, object: self.songPlayer?.currentItem)
  
      self.songPlayer?.addObserver(self, forKeyPath: "status", options: nil, context: nil)
      //NSTimer.scheduledTimerWithTimeInterval(0.1, target: self, selector: "updateProgress:", userInfo: nil, repeats: true)
  
  }
  </code></pre>
  
  <p>I'll appreciate any suggestion, doesn't matter using objective c or swift</p>