Add Open in PiP option (fix #137)

This commit is contained in:
Arkadiusz Fal
2022-05-29 16:38:37 +02:00
parent 3b1f6b21f3
commit 9abba2d19c
5 changed files with 61 additions and 22 deletions

View File

@@ -265,25 +265,7 @@ struct PlayerControls: View {
private var pipButton: some View {
button("PiP", systemImage: "pip") {
if player.activeBackend == .mpv {
player.avPlayerBackend.switchToMPVOnPipClose = true
}
#if !os(macOS)
player.exitFullScreen()
#endif
if player.activeBackend != PlayerBackendType.appleAVPlayer {
player.saveTime {
player.changeActiveBackend(from: .mpv, to: .appleAVPlayer)
}
}
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) {
print(player.pipController?.isPictureInPicturePossible ?? false ? "possible" : "NOT possible")
player.avPlayerBackend.startPictureInPictureOnPlay = true
player.pipController?.startPictureInPicture()
}
model.startPiP()
}
}