     
     private func handleBufferingEvent(keyPath: String) {
         if keyPath == "currentItem.playbackLikelyToKeepUp" {
-            if player.currentItem!.playbackLikelyToKeepUp == false {
+            if player?.currentItem!.playbackLikelyToKeepUp == false {
                 updateState(.Buffering)
             } else if currentState == .Buffering {
                 play()

    }
    
    private func handleStatusChangedEvent() {
        if player.status == .ReadyToPlay {
            readyToPlay()
        } else if player.status == .Failed {
            self.trigger(.Error, userInfo: ["error": player.currentItem!.error!])
        }
    }
    

    private var kvoTimeRangesContext = 0
    private var kvoBufferingContext = 0
    
    private var player: AVPlayer?
    private var playerLayer: AVPlayerLayer?
    private var currentState = PlaybackState.Idle
    
    public var url: NSURL?
