 import AVFoundation
 
 enum PlaybackState {
-    case Idle, Paused, Playing
+    case Idle, Paused, Playing, Buffering
 }
 
 public class AVFoundationPlayback: Playback {
     private var kvoStatusDidChangeContext = 0
     private var kvoTimeRangesContext = 0
     private var kvoBufferingContext = 0
-    private var kvoPlayerContext = 0
     
     private var player: AVPlayer!
     private var playerLayer: AVPlayerLayer!

    
    public override func play() {
        player.play()
        currentState = .Playing
        
        if !player.currentItem!.playbackLikelyToKeepUp {
            trigger(.Buffering)
        }
    }
    
    public override func pause() {
        player.pause()
        currentState = .Paused
        trigger(.Pause)
    }
    
    public override func isPlaying() -> Bool {

        player.removeObserver(self, forKeyPath: "currentItem.loadedTimeRanges")
        player.removeObserver(self, forKeyPath: "currentItem.playbackLikelyToKeepUp")
        player.removeObserver(self, forKeyPath: "currentItem.playbackBufferEmpty")
        NSNotificationCenter.defaultCenter().removeObserver(self)
    }
}