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
697 stars 264 forks source link

[Android] Make Stopping foreground service optional when app losses audio focus #404

Open amrfarid140 opened 2 years ago

amrfarid140 commented 2 years ago

Description

As it stands, if you set MusicControl.handleAudioInterruptions(true); this means the android app is listening on audio focus changes.

When the app losses focus, the listener calls emitter.onStop which ends up stopping the foreground service.

However, not all apps want that. For example, you might want to pause the audio instead of killing the playback altogether.

I am happy to submit a PR for this just opening the issue to take opinions on

  1. Will this change be accepted?
  2. How it should look like?
  1. Platform ?

    • [ ] iOS
    • [x] Android
3. Device - [x] Simulator - [x] Real device