mirror of
https://github.com/yattee/yattee.git
synced 2024-11-10 00:08:21 +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.lastSkipped = segment
|
||||||
|
self.model.handleOnPlayStream(stream)
|
||||||
self.model.play()
|
self.model.play()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
self.model.handleOnPlayStream(stream)
|
||||||
self.model.play()
|
self.model.play()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -486,7 +488,9 @@ final class AVPlayerBackend: PlayerBackend {
|
|||||||
if self.model.activeBackend == .appleAVPlayer,
|
if self.model.activeBackend == .appleAVPlayer,
|
||||||
self.isAutoplaying(playerItem)
|
self.isAutoplaying(playerItem)
|
||||||
{
|
{
|
||||||
self.model.updateAspectRatio()
|
if model.aspectRatio != aspectRatio {
|
||||||
|
self.model.updateAspectRatio()
|
||||||
|
}
|
||||||
|
|
||||||
if self.startPictureInPictureOnPlay,
|
if self.startPictureInPictureOnPlay,
|
||||||
let controller = self.model.pipController,
|
let controller = self.model.pipController,
|
||||||
@ -708,6 +712,17 @@ final class AVPlayerBackend: PlayerBackend {
|
|||||||
} else {
|
} else {
|
||||||
stopMusicMode()
|
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 {
|
var isStartingPiP: Bool {
|
||||||
|
@ -267,9 +267,11 @@ final class MPVBackend: PlayerBackend {
|
|||||||
|
|
||||||
self.model.lastSkipped = segment
|
self.model.lastSkipped = segment
|
||||||
self.play()
|
self.play()
|
||||||
|
self.model.handleOnPlayStream(stream)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
self.play()
|
self.play()
|
||||||
|
self.model.handleOnPlayStream(stream)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -182,6 +182,7 @@ final class PlayerModel: ObservableObject {
|
|||||||
private var currentArtwork: MPMediaItemArtwork?
|
private var currentArtwork: MPMediaItemArtwork?
|
||||||
|
|
||||||
var onPresentPlayer = [() -> Void]()
|
var onPresentPlayer = [() -> Void]()
|
||||||
|
var onPlayStream = [(Stream) -> Void]()
|
||||||
private var remoteCommandCenterConfigured = false
|
private var remoteCommandCenterConfigured = false
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
@ -1093,4 +1094,11 @@ final class PlayerModel: ObservableObject {
|
|||||||
guard let videoWidth = backend?.videoWidth, let videoHeight = backend?.videoHeight else { return "unknown" }
|
guard let videoWidth = backend?.videoWidth, let videoHeight = backend?.videoHeight else { return "unknown" }
|
||||||
return "\(String(format: "%.2f", videoWidth))\u{d7}\(String(format: "%.2f", videoHeight))"
|
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