0

How to update the url in react-native-track-player?

The urls I have expire after 3 hours and I would like to be able to update them in case we would like to use the app in the morning and continue the music from where we left.

I tried the following:

  1. Get current track index and get the current position
  2. Using remove(index) to remove the current track from the queue
  3. Regenerate the Track and add it to the queue using add()
  4. Seek to the position and playing the track again

The problem I faced with that approch was it didn't really remove the old one, rather just added the new one. And I don't know if it's the best way regarding performance ..

As a requirement, I must have unique tracks in the queue.

Thanks in advance!

Niroda
  • 320
  • 1
  • 3
  • 13
  • queue is maintained using states/props or just an array? – Muhammad Saqlain Apr 01 '23 at 12:46
  • neither, I don't want to make it too complex. Just before adding the new track, I get all tracks using `getQueue()` and use a unique key on each track to check whether the track exists or not – Niroda Apr 01 '23 at 13:06

0 Answers0