     }
 
     @objc private func playbackDidEnd(notification: NSNotification? = nil) {
-        if let object = notification?.object as? AVPlayerItem, let item = self.player?.currentItem {
+        if let object = notification?.object as? AVPlayerItem, let item = player?.currentItem {
             if object == item {
                 let duration = item.duration
                 let position = item.currentTime()

        player?.appliesMediaSelectionCriteriaAutomatically = false
    }

    private func setupPlayer() {
        if let asset = self.asset {
            createPlayerInstance(with: AVPlayerItem(asset: asset))
            playerLayer = AVPlayerLayer(player: player)
            view.layer.addSublayer(playerLayer!)
            playerLayer?.frame = view.bounds
            setupMaxResolution(for: playerLayer!.frame.size)

            if startAt != 0.0 && playbackType == .vod {
                seek(startAt)
            }

            asset.wait(for: characteristicsKey, then: selectDefaultAudioIfNeeded)

            addObservers()
        } else {
            trigger(.error)
            Logger.logError("could not setup player", scope: pluginName)
        }
    }

    #if os(tvOS)

    }

    private func relativeTime(to time: TimeInterval) -> TimeInterval {
        return isDvrAvailable ? time + (dvrWindowStart ?? 0) : time
    }

    private func triggerDvrStatusIfNeeded() {
