fix(player): harden Apple PiP handling

This commit is contained in:
edde746
2026-05-08 07:40:41 +02:00
parent e10cc7d273
commit 1e6bd01987
8 changed files with 97 additions and 69 deletions
@@ -27,13 +27,11 @@ import UIKit
func setup(with layer: CALayer, containerView: UIView) {}
func setAutoStart(_ enabled: Bool) {}
func warmLayer(currentTime: Double, isPlaying: Bool) {}
func pushBlankFrame(width: Int32 = 1920, height: Int32 = 1080) {}
func startPip(waitForFrame: Bool = true, completion: @escaping (Bool) -> Void) {
completion(false)
}
func stopPip() {}
func invalidatePlaybackState() {}
func flushLayer() {}
func syncTimebase(currentTime: Double, isPlaying: Bool) {}
func teardown() {}
}
@@ -112,11 +110,6 @@ import UIKit
pipController?.canStartPictureInPictureAutomaticallyFromInline = enabled
}
/// vo_avfoundation renders into the inline display layer, so PiP reuses
/// the current video frame instead of pushing synthetic buffers here.
func pushBlankFrame(width: Int32 = 1920, height: Int32 = 1080) {
}
/// Sync the layer's controlTimebase with the actual playback position.
/// This makes the PiP progress bar show the correct time.
func syncTimebase(currentTime: Double, isPlaying: Bool) {
@@ -208,9 +201,6 @@ import UIKit
delegateHelper = nil
}
/// PiP shares the inline display layer, so cleanup must not flush it.
func flushLayer() {
}
}
// MARK: - PiP Delegate Helper (iOS 15+)
+1
View File
@@ -162,6 +162,7 @@ class MpvPlayerCore: MpvPlayerCoreBase {
override func updateEDRMode(sigPeak: Double) {
guard let videoLayer else { return }
let hdrEnabled = self.hdrEnabled
var edrHeadroom: CGFloat = 1.0
#if os(iOS)
if #available(iOS 17.0, *) {