From dc74300ef5952d9030ffe213651cde53976af84d Mon Sep 17 00:00:00 2001 From: edde746 <86283021+edde746@users.noreply.github.com> Date: Fri, 1 May 2026 07:03:14 +0200 Subject: [PATCH] fix: avoid macOS fullscreen playback stalls close #934 --- macos/Runner/MpvPlayer/MpvPlayerCore.swift | 34 +++------------------- 1 file changed, 4 insertions(+), 30 deletions(-) diff --git a/macos/Runner/MpvPlayer/MpvPlayerCore.swift b/macos/Runner/MpvPlayer/MpvPlayerCore.swift index c99d7f2e..ad5b5012 100644 --- a/macos/Runner/MpvPlayer/MpvPlayerCore.swift +++ b/macos/Runner/MpvPlayer/MpvPlayerCore.swift @@ -46,24 +46,12 @@ class MpvPlayerCore: MpvPlayerCoreBase { } let center = NotificationCenter.default - center.addObserver( - self, - selector: #selector(windowWillEnterFullScreen), - name: NSWindow.willEnterFullScreenNotification, - object: window - ) center.addObserver( self, selector: #selector(windowDidEnterFullScreen), name: NSWindow.didEnterFullScreenNotification, object: window ) - center.addObserver( - self, - selector: #selector(windowWillExitFullScreen), - name: NSWindow.willExitFullScreenNotification, - object: window - ) center.addObserver( self, selector: #selector(windowDidExitFullScreen), @@ -196,28 +184,14 @@ class MpvPlayerCore: MpvPlayerCoreBase { dispose() } - @objc private func windowWillEnterFullScreen(_ notification: Notification) { - guard mpv != nil, !isPipActive else { return } - print("[MpvPlayerCore] willEnterFullScreen - disabling video output") - mpv_set_property_string(mpv, "vid", "no") - } - @objc private func windowDidEnterFullScreen(_ notification: Notification) { - guard mpv != nil, !isPipActive else { return } - print("[MpvPlayerCore] didEnterFullScreen - re-enabling video output") - mpv_set_property_string(mpv, "vid", "auto") - } - - @objc private func windowWillExitFullScreen(_ notification: Notification) { - guard mpv != nil, !isPipActive else { return } - print("[MpvPlayerCore] willExitFullScreen - disabling video output") - mpv_set_property_string(mpv, "vid", "no") + guard !isPipActive else { return } + updateFrame() } @objc private func windowDidExitFullScreen(_ notification: Notification) { - guard mpv != nil, !isPipActive else { return } - print("[MpvPlayerCore] didExitFullScreen - re-enabling video output") - mpv_set_property_string(mpv, "vid", "auto") + guard !isPipActive else { return } + updateFrame() } @objc private func windowOcclusionDidChange(_ notification: Notification) {