fix(ios): enable PiP subtitles

This commit is contained in:
edde746
2026-05-25 04:47:55 +02:00
parent 5fa8326341
commit 6b147e2053
5 changed files with 22 additions and 4 deletions
+17 -1
View File
@@ -426,6 +426,22 @@ class MpvPlayerCoreBase: NSObject {
}
}
/// PiP presents the AVSampleBufferDisplayLayer directly, so subtitles must
/// be composited into the video samples instead of the inline OSD layer.
func setPipSubtitleCompositing(_ enabled: Bool) {
#if os(iOS)
let value = enabled ? "yes" : "no"
setRawStringPropertyAsync("avfoundation-pip-composite-osd", value: value) { result in
if case .failure(let error) = result {
print(
"[MpvPlayerCore] Failed to set PiP subtitle compositing "
+ "to \(value): \(error.localizedDescription)"
)
}
}
#endif
}
func getPropertyAsync(_ name: String, completion: @escaping (Result<String?, Error>) -> Void) {
guard let mpv else {
completion(.success(nil))
@@ -611,7 +627,7 @@ class MpvPlayerCoreBase: NSObject {
private func isManagedRendererProperty(_ name: String) -> Bool {
name == "vo" || name == "wid" || name == "gpu-api" || name == "gpu-context"
|| name == "avfoundation-composite-osd"
|| name == "avfoundation-composite-osd" || name == "avfoundation-pip-composite-osd"
}
private func updateVideoGravityIfNeeded(name: String, value: String) {