     }
     
     private func bindPlaybackEvents() {
-        guard let playback = core?.activePlayback else { return }
+        guard let playback = playback else { return }
         listenToOnce(playback, eventName: Event.bufferUpdate.rawValue) { [weak self] (_: EventUserInfo) in self?.triggerDvrEvent() }
     }
     

        listenTo(container, eventName: InternalEvent.didChangePlayback.rawValue) { [weak self] (_: EventUserInfo) in self?.bindEvents() }
    }
    
    private var dvrEnabled: Bool {
        guard let playback = core?.activePlayback as? AVFoundationPlayback else { return false }
        guard let player = playback.player else { return false }
        return playback.playbackType == .live && CMTimeGetSeconds(player.currentTime()) >= minDvrSize
    }
    
    func triggerDvrEvent() {
        guard let playback = core?.activePlayback else { return }
        playback.trigger(InternalEvent.detectDVR.rawValue, userInfo: ["enabled": dvrEnabled])
    }
}

        super.init(context: context)
        bindEvents()
    }
    
    private var playback: AVFoundationPlayback? {
        return core?.activePlayback as? AVFoundationPlayback
    }
}

//MARK: Events Binding
extension DVRPlugin {
    private func bindEvents() {
        stopListening()
        
        bindCoreEvents()
