From 46b1ef953047a483af8dc2ccbf208d3e55724071 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Fri, 19 Aug 2022 00:38:09 +0200 Subject: [PATCH] Don't switch to MPV after closing PiP --- Model/Player/Backends/AVPlayerBackend.swift | 1 - Model/Player/PiPDelegate.swift | 11 ----------- Model/Player/PlayerControlsModel.swift | 4 ---- Model/Player/PlayerModel.swift | 1 - 4 files changed, 17 deletions(-) diff --git a/Model/Player/Backends/AVPlayerBackend.swift b/Model/Player/Backends/AVPlayerBackend.swift index c64b1580..5fca90bf 100644 --- a/Model/Player/Backends/AVPlayerBackend.swift +++ b/Model/Player/Backends/AVPlayerBackend.swift @@ -56,7 +56,6 @@ final class AVPlayerBackend: PlayerBackend { private(set) var avPlayer = AVPlayer() var controller: AppleAVPlayerViewController? var startPictureInPictureOnPlay = false - var switchToMPVOnPipClose = false private var asset: AVURLAsset? private var composition = AVMutableComposition() diff --git a/Model/Player/PiPDelegate.swift b/Model/Player/PiPDelegate.swift index 082261ef..a9502da9 100644 --- a/Model/Player/PiPDelegate.swift +++ b/Model/Player/PiPDelegate.swift @@ -24,17 +24,6 @@ final class PiPDelegate: NSObject, AVPictureInPictureControllerDelegate { return } - if player.avPlayerBackend.switchToMPVOnPipClose, - !player.currentItem.isNil - { - DispatchQueue.main.async { - player.avPlayerBackend.switchToMPVOnPipClose = false - player.saveTime { - player.changeActiveBackend(from: .appleAVPlayer, to: .mpv) - } - } - } - player.playingInPictureInPicture = false } diff --git a/Model/Player/PlayerControlsModel.swift b/Model/Player/PlayerControlsModel.swift index 3f216c8b..0d508f63 100644 --- a/Model/Player/PlayerControlsModel.swift +++ b/Model/Player/PlayerControlsModel.swift @@ -132,10 +132,6 @@ final class PlayerControlsModel: ObservableObject { } func startPiP(startImmediately: Bool = true) { - if player.activeBackend == .mpv { - player.avPlayerBackend.switchToMPVOnPipClose = true - } - #if !os(macOS) player.exitFullScreen() #endif diff --git a/Model/Player/PlayerModel.swift b/Model/Player/PlayerModel.swift index 748b1d95..11a330b5 100644 --- a/Model/Player/PlayerModel.swift +++ b/Model/Player/PlayerModel.swift @@ -868,7 +868,6 @@ final class PlayerModel: ObservableObject { if musicMode { if playingInPictureInPicture { avPlayerBackend.pause() - avPlayerBackend.switchToMPVOnPipClose = false closePiP() } changeActiveBackend(from: .appleAVPlayer, to: .mpv)