From 78a5ff0fe0ff126dc729d02dc61cce206fd6e06b Mon Sep 17 00:00:00 2001 From: edde746 <86283021+edde746@users.noreply.github.com> Date: Wed, 3 Dec 2025 06:16:19 +0100 Subject: [PATCH] fix: darwin playback crash --- ios/Runner/MpvPlayer/MpvPlayerCore.swift | 4 ++-- macos/Runner/MpvPlayer/MpvPlayerCore.swift | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ios/Runner/MpvPlayer/MpvPlayerCore.swift b/ios/Runner/MpvPlayer/MpvPlayerCore.swift index e2465c52..3273dc16 100644 --- a/ios/Runner/MpvPlayer/MpvPlayerCore.swift +++ b/ios/Runner/MpvPlayer/MpvPlayerCore.swift @@ -27,7 +27,7 @@ private class MetalLayer: CAMetalLayer { if Thread.isMainThread { super.wantsExtendedDynamicRangeContent = newValue } else { - DispatchQueue.main.sync { + DispatchQueue.main.async { super.wantsExtendedDynamicRangeContent = newValue } } @@ -113,7 +113,7 @@ class MpvPlayerCore: NSObject { checkError(mpv_set_option_string(mpv, "vo", "gpu-next")) checkError(mpv_set_option_string(mpv, "gpu-api", "vulkan")) checkError(mpv_set_option_string(mpv, "gpu-context", "moltenvk")) - // hwdec is set from Flutter via setProperty based on user preference + checkError(mpv_set_option_string(mpv, "hwdec", "videotoolbox")) // Initialize MPV let initResult = mpv_initialize(mpv) diff --git a/macos/Runner/MpvPlayer/MpvPlayerCore.swift b/macos/Runner/MpvPlayer/MpvPlayerCore.swift index c94997cd..36f71f91 100644 --- a/macos/Runner/MpvPlayer/MpvPlayerCore.swift +++ b/macos/Runner/MpvPlayer/MpvPlayerCore.swift @@ -26,7 +26,7 @@ private class MetalLayer: CAMetalLayer { if Thread.isMainThread { super.wantsExtendedDynamicRangeContent = newValue } else { - DispatchQueue.main.sync { + DispatchQueue.main.async { super.wantsExtendedDynamicRangeContent = newValue } } @@ -117,7 +117,7 @@ class MpvPlayerCore: NSObject { checkError(mpv_set_option_string(mpv, "vo", "gpu-next")) checkError(mpv_set_option_string(mpv, "gpu-api", "vulkan")) checkError(mpv_set_option_string(mpv, "gpu-context", "moltenvk")) - // hwdec is set from Flutter via setProperty based on user preference + checkError(mpv_set_option_string(mpv, "hwdec", "videotoolbox")) // Initialize MPV let initResult = mpv_initialize(mpv)