-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[discussion] Configurable audio behavior #1103
Comments
I have been looking at the docs for how Expo handles audio mixing: Based on this, I think we support 3 props: ignoreSilentSwitchControl whether to play audio when the silent switch is on. Already implemented, iOS only audioRecordingAllow audio recording. iOS only audioMode
Some combinations of these props will be invalid and will throw an error. I suspect we will want to make it so that muting or setting the volume to 0 ignores these modes. I will need to do more testing to see how this working when there are multiple videos playing at the same time. |
Any update on this? Does anyone have a fork? |
I assume this needs work? #959 |
@evanjmg did you find something to manage sound from other apps? |
@camel113 Unfortunately not, I've had to make my own native library for the feature I wanted - https://github.com/evanjmg/react-native-sound-detection |
There is a fork of react-native-video branch (https://github.com/Stormotion-Mobile/react-native-video) which partly implements desired behavior both on Android and iOS, my colleague used it in his project and it worked good for him, he needed to switch between different audio modes by pressing button. Note, that most likely it has breaking changes.
It works by introducing For my use case, I needed to interrupt 3rd party audio and then resume it after my app's video finished. I used |
@CyxouD this fork works great did the same you did |
@ditorojuan |
One of the most requested features is greater configurability on how the audio mixing should behave. This bug is intended to be a place to first discuss how the configuration should work, then track implementation.
There are a number of use cases people have requested including:
Here is an overview of the behavior on mobile platforms. We can ignore Windows since the audio channel is always shared.
iOS offers the following modes:
We can ignore the following options:
AVAudioSessionCategoryRecord: input only
AVAudioSessionCategoryMultiRoute: currently this project doesn't support multiple output devices
Sample configuration call:
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient error:nil];
On Android, there is a concept of audio focus. Each type of audio stream (phone call, media, notifications) can have one app that is using that stream at the same time. Focus should be acquired when playback is about to start and released when media pauses.
Sample configuration call:
requestAudioFocus(listener, STREAM_MUSIC, AUDIOFOCUS_GAIN);
Ducking:
"ducking" is the behavior of the OS lowering the volume of an audio stream to allow other streams to play on top of it. A good example of this is allowing a song to continue playing while playing a text beep.
More to come...need to extensively test behavior when handling notifications like text and incoming phone calls
The text was updated successfully, but these errors were encountered: