From 6308a7431d33ed1dfa57e1e0ae4dcf6792d3f1cb Mon Sep 17 00:00:00 2001 From: tapframe <85391825+tapframe@users.noreply.github.com> Date: Thu, 12 Mar 2026 00:15:12 +0530 Subject: [PATCH] feat: disable interactivity for player view controller and improve player destruction logic --- JustPlayer | 1 + MPVKit | 1 + .../com/nuvio/app/features/player/PlayerEngine.ios.kt | 1 + iosApp/iosApp/Player/MPVPlayerBridge.swift | 9 +++------ 4 files changed, 6 insertions(+), 6 deletions(-) create mode 160000 JustPlayer create mode 160000 MPVKit diff --git a/JustPlayer b/JustPlayer new file mode 160000 index 00000000..3d432407 --- /dev/null +++ b/JustPlayer @@ -0,0 +1 @@ +Subproject commit 3d432407da3665aa0636f131f6801c5bc35c50e3 diff --git a/MPVKit b/MPVKit new file mode 160000 index 00000000..0c01e295 --- /dev/null +++ b/MPVKit @@ -0,0 +1 @@ +Subproject commit 0c01e295f078f8382edcd0bb5326412791084146 diff --git a/composeApp/src/iosMain/kotlin/com/nuvio/app/features/player/PlayerEngine.ios.kt b/composeApp/src/iosMain/kotlin/com/nuvio/app/features/player/PlayerEngine.ios.kt index 83b235c8..1a4d1b67 100644 --- a/composeApp/src/iosMain/kotlin/com/nuvio/app/features/player/PlayerEngine.ios.kt +++ b/composeApp/src/iosMain/kotlin/com/nuvio/app/features/player/PlayerEngine.ios.kt @@ -192,5 +192,6 @@ actual fun PlatformPlayerSurface( UIKitViewController( factory = { bridge.createPlayerViewController() }, modifier = modifier, + interactive = false, ) } diff --git a/iosApp/iosApp/Player/MPVPlayerBridge.swift b/iosApp/iosApp/Player/MPVPlayerBridge.swift index 72292f7e..434b3f8a 100644 --- a/iosApp/iosApp/Player/MPVPlayerBridge.swift +++ b/iosApp/iosApp/Player/MPVPlayerBridge.swift @@ -325,10 +325,9 @@ final class MPVPlayerViewController: UIViewController { func destroyPlayer() { NotificationCenter.default.removeObserver(self) - if let mpv = mpv { - mpv_terminate_destroy(mpv) - } - mpv = nil + guard let ctx = mpv else { return } + mpv = nil // nil first so event loop stops reading + mpv_terminate_destroy(ctx) } // MARK: - State Update @@ -416,8 +415,6 @@ final class MPVPlayerViewController: UIViewController { } } case MPV_EVENT_SHUTDOWN: - mpv_terminate_destroy(mpv) - self.mpv = nil return case MPV_EVENT_LOG_MESSAGE: if let msg = UnsafeMutablePointer(OpaquePointer(eventPtr.pointee.data)) {