zmxv / react-native-sound

React Native module for playing sound clips
MIT License
2.79k stars 748 forks source link

Advance playlist in background on Android #560

Open marymhart opened 5 years ago

marymhart commented 5 years ago

I am attempting to create a playlist that plays continuously even when the app is in the background. This works when the app is in the foreground & when I am playing the playlist in the background on iOS but when I am playing a playlist in the background on Android, it does not advance to the next song until I re-open the app. Any idea whether this is possible on Android? Thank you!

dengue8830 commented 5 years ago

i'm doing the exact same thing, now i have to face the android side of may app. What did you do with android?

As far as i know, even in ios this behavior is not supported by default because we are working in the js thread and it will live as much as the system doesn't need that memory. We need a way to register our code in order to be executed in background with some kind of background task. In react native we have a couple of choices but my preferred is this one. I guess we can keep the reference this of our custom js player instance, i will try this and will post my result for future devs come here