diff --git a/app.json b/app.json index a95ce470..af6cc4b1 100644 --- a/app.json +++ b/app.json @@ -23,7 +23,8 @@ }, "UISupportsTrueScreenSizeOnMac": true, "UIFileSharingEnabled": true, - "LSSupportsOpeningDocumentsInPlace": true + "LSSupportsOpeningDocumentsInPlace": true, + "AVInitialRouteSharingPolicy": "LongFormAudio" }, "config": { "usesNonExemptEncryption": false diff --git a/components/video-player/controls/hooks/useRemoteControl.ts b/components/video-player/controls/hooks/useRemoteControl.ts index 0a71b8b0..f1a7822f 100644 --- a/components/video-player/controls/hooks/useRemoteControl.ts +++ b/components/video-player/controls/hooks/useRemoteControl.ts @@ -107,6 +107,7 @@ export function useRemoteControl({ updateTime(updated); break; } + case "playPause": case "select": { if (isRemoteScrubbing.value && remoteScrubProgress.value != null) { progress.value = remoteScrubProgress.value; diff --git a/modules/mpv-player/ios/MpvPlayerView.swift b/modules/mpv-player/ios/MpvPlayerView.swift index 71ee21e2..e21978d1 100644 --- a/modules/mpv-player/ios/MpvPlayerView.swift +++ b/modules/mpv-player/ios/MpvPlayerView.swift @@ -1,3 +1,4 @@ +import AVFAudio import AVFoundation import CoreMedia import ExpoModulesCore @@ -63,6 +64,7 @@ class MpvPlayerView: ExpoView { private func setupView() { clipsToBounds = true backgroundColor = .black + configureAudioSession() videoContainer = UIView() videoContainer.translatesAutoresizingMaskIntoConstraints = false @@ -111,6 +113,21 @@ class MpvPlayerView: ExpoView { CATransaction.commit() } + private func configureAudioSession() { + let audioSession = AVAudioSession.sharedInstance() + do { + try audioSession.setCategory( + .playback, + mode: .moviePlayback, + policy: .longFormAudio, + options: [] + ) + try audioSession.setActive(true) + } catch { + print("Failed to configure audio session: \(error)") + } + } + func loadVideo(config: VideoLoadConfig) { // Skip reload if same URL is already playing if currentURL == config.url {