TheWidlarzGroup / react-native-video

A <Video /> component for react-native
https://docs.thewidlarzgroup.com/react-native-video/
MIT License
7.21k stars 2.9k forks source link

[Android] Mute my application's sound when another application sound is open #2813

Open hoangsang0109 opened 2 years ago

hoangsang0109 commented 2 years ago

Hello, thanks for your library.

I have an issue like this:

When I play music on my app then I play music on another app (For example Youtube).

The result is 2 sounds playing together. How to mute my application's sound when another application's sound is open?

Platform

Which player are you experiencing the problem on:

freeboub commented 2 years ago

Do you use playInBackground ? do you use disableFocus ?

hoangsang0109 commented 2 years ago

Do you use playInBackground ? do you use disableFocus ?

Yes, I use both. This is my code, please check. Thanks

<Video ref={videoRef} volume={1} repeat={repeat} audioOnly={true} source={{ uri: audioSource }} mixWithOthers={undefined} paused={isPaused} onLoad={onLoadVideo} onEnd={onEnd} onProgress={onProgress} ignoreSilentSwitch={'ignore'} playWhenInactive={true} playInBackground={true} disableFocus={true} />

freeboub commented 2 years ago

Did you try to put disableFocus to false ? I think it should solve your issue

jaswant25 commented 2 years ago

Did you try to put disableFocus to false ? I think it should solve your issue

Yes , I am facing the same issue, It doesn't pause other audio streams.

jeandiasl commented 1 year ago

I am facing the same issue, It doesn't pause other audio streams.