         }
     }
 
-    private func enableBackgroundSession() {
-        backgroundSessionBackup = AVAudioSession.sharedInstance().category
-        changeBackgroundSession(to: .playback)
-    }
-
-    private func restoreBackgroundSession() {
-        if let backgroundSession = backgroundSessionBackup {
-            changeBackgroundSession(to: backgroundSession)
-        }
-    }
-
-    private func changeBackgroundSession(to category: AVAudioSession.Category) {
-        do {
-            try AVAudioSession.sharedInstance().setCategory(category, mode: .default, options: [.allowAirPlay])
-        } catch {
-            print("It was not possible to set the audio session category")
-        }
-    }
-
     @objc internal func seekOnReadyIfNeeded() {
         if let timeToSeek = seekToTimeWhenReadyToPlay {
             seek(timeToSeek)

            player.observe(\.currentItem?.status, options: .new, changeHandler: handleStatusChangedEvent),
            player.observe(\.currentItem?.loadedTimeRanges, options: .new, changeHandler: handleLoadedTimeRangesEvent),
            player.observe(\.currentItem?.seekableTimeRanges, options: .new, changeHandler: handleSeekableTimeRangesEvent),
        ]

        player.addObserver(self, forKeyPath: "currentItem.playbackLikelyToKeepUp",
                            options: .new, context: &kvoBufferingContext)
        player.addObserver(self, forKeyPath: "currentItem.playbackBufferEmpty",
                            options: .new, context: &kvoBufferingContext)
        player.addObserver(self, forKeyPath: "externalPlaybackActive",
                            options: .new, context: &kvoExternalPlaybackActiveContext)
        player.addObserver(self, forKeyPath: "rate",
                            options: .new, context: &kvoPlayerRateContext)


        guard let player = player, player.observationInfo != nil else { return }
        player.removeObserver(self, forKeyPath: "currentItem.playbackLikelyToKeepUp")
        player.removeObserver(self, forKeyPath: "currentItem.playbackBufferEmpty")
        player.removeObserver(self, forKeyPath: "rate")
        if let timeObserver = timeObserver {
            player.removeTimeObserver(timeObserver)
