         }
     }
 
-    fileprivate func bindPlayer(playback: Playback?) {
+    private func bindPlayer(playback: Playback?) {
         if let avFoundationPlayback = (playback as? AVFoundationPlayback), let player = avFoundationPlayback.player {
-            viewController?.player = player
-            viewController?.delegate = avFoundationPlayback
-        }
-    }
-
-    fileprivate func unbindPlaybackEvents() {
+            self.player = player
+            delegate = avFoundationPlayback
+        }
+    }
+
+    private func unbindPlaybackEvents() {
         for eventId in playbackEventsListenIds {
             baseObject.stopListening(eventId)
         }


open class Player: AVPlayerViewController {
    open var playbackEventsToListen: [String] = []
    fileprivate var playbackEventsListenIds: [String] = []
    fileprivate(set) var core: Core?
    static var hasAlreadyRegisteredPlaybacks = false
    fileprivate var viewController: AVPlayerViewController!
    private let baseObject = BaseObject()

    override open func viewDidLoad() {
        core?.parentView = view

        if isMediaControlEnabled != false {
            viewController = DecoratedPressAVPlayerViewController(player: self)
            core?.parentView = viewController?.contentOverlayView
            core?.parentController = self
            addChild(viewController)
            viewController.view.frame = view.bounds
            viewController.view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
            view.addSubview(viewController.view)
            viewController.didMove(toParent: self)
        }

        NotificationCenter.default.addObserver(self, selector: #selector(Player.willEnterForeground), name:
            UIApplication.willEnterForegroundNotification, object: nil)

        core?.render()
    }

    open var isMediaControlEnabled: Bool {
        return core?.options[kMediaControl] as? Bool ?? false
    }

    @objc fileprivate func willEnterForeground() {
        if let playback = activePlayback as? AVFoundationPlayback, !isMediaControlEnabled {
            Logger.logDebug("forced play after return from background", scope: "Player")
            playback.play()

        return baseObject.listenTo(contextObject, eventName: eventName, callback: callback)
    }

    private func bindPlaybackEvents() {
        if let playback = core?.activePlayback {
            for event in playbackEventsToListen {
                let listenId = baseObject.listenTo(
