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

Not working on iOS with react-native-audio-toolkit framework #392

Closed futureinapps closed 3 years ago

futureinapps commented 3 years ago

Description

  1. Sample code (provide repo url or sample code)

in componentDidMount i call this:

RNMS.enableBackgroundMode(true);
RNMS.handleAudioInterruptions(true);
RNMS.enableControl('play', true);
RNMS.enableControl('pause', false);
RNMS.enableControl('nextTrack', false);
RNMS.enableControl('previousTrack', false);
RNMS.on(Command.play, () => {
  dispatch(startPractice() as any);
});
RNMS.on(Command.pause, () => {
  dispatch(pausePractice() as any);
});

onPlay i call setNowPlaying

  1. Platform ?

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

Hi @futureinapps, I'm happy to look into this but you'll need to provide a reproducible project or bigger code sample. I need to be able to simulate your issue, but I can't with the above info. Thanks :)

futureinapps commented 3 years ago

Yesterday, I spent the tones of time to investigate this issue and found out that it was a bug with the @react-native-community/audio-toolkit framework. I solved the problem by adding this changes

bradfloodx commented 3 years ago

Ok sweet thanks @futureinapps