feat(ios): expose custom audio session control#3804
Open
Aniketiitk21 wants to merge 1 commit intomrousavy:mainfrom
Open
feat(ios): expose custom audio session control#3804Aniketiitk21 wants to merge 1 commit intomrousavy:mainfrom
Aniketiitk21 wants to merge 1 commit intomrousavy:mainfrom
Conversation
|
@Aniketiitk21 is attempting to deploy a commit to the Margelo Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
automaticallyConfiguresApplicationAudioSessiononCameraSessionConfigurationand the publicuseCamera()/<Camera />APIallowBackgroundAudioPlaybacksession option on the public React APIAVAudioSessioncontrol to another library such asreact-native-volume-managerWhy
Issue #2581 asks for more customized audio control, especially for apps that behave more like FaceTime where media playback and microphone capture need to coexist.
The most important missing piece today is that VisionCamera's iOS capture sessions still own application-level audio-session behavior, while apps have no supported way to tell VisionCamera to stop auto-configuring
AVAudioSession. That makes it hard to use customvideoChat,voiceChat, ormeasurementmodes through another native integration, and it blocks the exactdisableAudioSessionstyle escape hatch requested in the issue.This change adds that escape hatch while also exposing the already-implemented background-audio-mixing flag on the public React API.
Implementation
automaticallyConfiguresApplicationAudioSession?: booleantoCameraSessionConfigurationuseCameraController()anduseCamera()/<Camera />AVCaptureSession.automaticallyConfiguresApplicationAudioSessionon the mainHybridCameraSessionconfiguresApplicationAudioSessionToMixWithOthersin sync when VisionCamera is still managing the app audio sessionNativeCameraOutputwith a session-aware configure hook so outputs that need session-wide state can opt in without changing every output implementationAudioSessionrespect the same audio-session-management setting and background-audio-mixing flagAVAudioSessionBehavior
automaticallyConfiguresApplicationAudioSession: falsetells VisionCamera to stop auto-managing the app audio session on iOSAVAudioSessionthemselves through another native moduleallowBackgroundAudioPlaybackis now reachable from the public React API and continues to work when VisionCamera is managing the app audio sessionTesting
npm run typechecktsc --noEmit false && nitrogen.\gradlew.bat :react-native-vision-camera:compileDebugKotlin --no-daemon --console=plainNotes
AVAudioSessionescape hatch is iOS-specificCloses #2581