0

I am developing an app for a radio station using react-native-track-player. I have this working fine. When I press Pause, the player pauses as expected, but when I press Play again the audio continues where it left off on the stream. I would like to effectively "reset" the stream when paused, so that playing again will always pick up the latest audio - like a radio station should as it's live. I tried removing the track using TrackPlayer.remove([trackIndex]) where trackIndex = await TrackPlayer.getCurrentTrack() but this doesn't have the desired effect, it just carries on where the stream paused.

Can anyone help?

Thanks

Steve W
  • 97
  • 7

1 Answers1

0

When you call pause, you can use reset an after add the tracks

Something like that

TrackPlayer.pause();
TrackPlayer.reset();
TrackPlayer.add(track);