tanguyantoine / react-native-music-control

Display and manage media controls on lock screen and notification center for iOS and Android.
https://www.npmjs.com/package/react-native-music-control
MIT License
695 stars 265 forks source link

Handling loss and gain of audio focus #365

Open rohit-ganapathy opened 3 years ago

rohit-ganapathy commented 3 years ago

Description

The module is failing in these two cases:

1) If I have something audio playing on the app and move on to play something on spotify or youtube (i.e. I lose audio focus), the music keeps on playing.(Ideally it should emit a pause event?)

2) If I play something on my app while a youtube video or a spotify song is playing, my app plays over them. Ideally the spotify song or YT video should get paused.

I see a MusicControlAudioFocusListener.java that seems to have the audio focus related methods but I doubt they're in action because my logging statements don't get triggered when audio focus changes.

  1. Platform ?

    • [ ] iOS
    • [x] Android
3. Device - [ ] Simulator - [x] Real device
lavpreetsandhu commented 2 years ago

hi.. have you find any solution for this ?