Open slycoder opened 5 years ago
Hi @slycoder,
It looks like you have a workaround for now, we'll take this into consideration because what's happening is that the audio library that we use itself changes the category and we change it so that we can record audio during screen recording. However, this might be something that we can do later when the developer actually requests/desires to screen record as opposed to immediately during creation of the view.
Thanks for reporting this to us, we'll post on this issue with any future updates.
Hi @slycoder, can you post a demo of where you structured that and how it should look? Looks like I am missing something and unable to do it.
It's been many years since I did this, but you can read more about method swizzling here: https://nshipster.com/method-swizzling/ Just apply that to setCategory on AVAudioSession and ignore any calls that are not in the category you care about.
Environment
Description
ViroReact seems to be resetting the sound playback mode set in the app. Somewhere in
[VRT3DSceneNavigator didSetProps:]
it seems to be calling[AVAudioSession setCategory:]
(I determined this via a symbolic breakpoint). This is having some unintended effects on audio playback elsewhere. For example, if the app had previously set the category toPlayback
with theAVAudioSessionCategoryOptionMixWithOthers
option in order to allow background audio from other apps, mounting the Viro scene will cause that background audio to stop, even if no audio is being emitted from the Viro scene.Reproducible Demo
Start the app and observe that any audio playing in the background keeps playing.
Mount any
Viro3DSceneNavigator
. Observe that the background audio is now interrupted.Note that you can get around this by swizzling
AVAudioSession
'ssetCategory
.