mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 13:33:42 +00:00
Fix switching to AVPlayer in fullscreen
This commit is contained in:
parent
f3a8a0977c
commit
8d11a92f97
@ -353,9 +353,11 @@ final class AVPlayerBackend: PlayerBackend {
|
||||
}
|
||||
|
||||
self.model.lastSkipped = segment
|
||||
self.model.handleOnPlayStream(stream)
|
||||
self.model.play()
|
||||
}
|
||||
} else {
|
||||
self.model.handleOnPlayStream(stream)
|
||||
self.model.play()
|
||||
}
|
||||
}
|
||||
@ -486,7 +488,9 @@ final class AVPlayerBackend: PlayerBackend {
|
||||
if self.model.activeBackend == .appleAVPlayer,
|
||||
self.isAutoplaying(playerItem)
|
||||
{
|
||||
self.model.updateAspectRatio()
|
||||
if model.aspectRatio != aspectRatio {
|
||||
self.model.updateAspectRatio()
|
||||
}
|
||||
|
||||
if self.startPictureInPictureOnPlay,
|
||||
let controller = self.model.pipController,
|
||||
@ -708,6 +712,17 @@ final class AVPlayerBackend: PlayerBackend {
|
||||
} else {
|
||||
stopMusicMode()
|
||||
}
|
||||
|
||||
#if os(iOS)
|
||||
ControlOverlaysModel.shared.hide()
|
||||
model.navigation.presentingPlaybackSettings = false
|
||||
|
||||
if model.playingFullScreen {
|
||||
model.onPlayStream.append { _ in
|
||||
self.controller.enterFullScreen(animated: true)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
var isStartingPiP: Bool {
|
||||
|
@ -267,9 +267,11 @@ final class MPVBackend: PlayerBackend {
|
||||
|
||||
self.model.lastSkipped = segment
|
||||
self.play()
|
||||
self.model.handleOnPlayStream(stream)
|
||||
}
|
||||
} else {
|
||||
self.play()
|
||||
self.model.handleOnPlayStream(stream)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -182,6 +182,7 @@ final class PlayerModel: ObservableObject {
|
||||
private var currentArtwork: MPMediaItemArtwork?
|
||||
|
||||
var onPresentPlayer = [() -> Void]()
|
||||
var onPlayStream = [(Stream) -> Void]()
|
||||
private var remoteCommandCenterConfigured = false
|
||||
|
||||
init() {
|
||||
@ -1093,4 +1094,11 @@ final class PlayerModel: ObservableObject {
|
||||
guard let videoWidth = backend?.videoWidth, let videoHeight = backend?.videoHeight else { return "unknown" }
|
||||
return "\(String(format: "%.2f", videoWidth))\u{d7}\(String(format: "%.2f", videoHeight))"
|
||||
}
|
||||
|
||||
func handleOnPlayStream(_ stream: Stream) {
|
||||
backend.setRate(currentRate)
|
||||
|
||||
onPlayStream.forEach { $0(stream) }
|
||||
onPlayStream.removeAll()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user