-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
First track Audio file is fetched and played momentarily when multiple tracks add()
ed
#1781
Comments
Yes, I have the same issue. When skipping to a next live stream, I can hear the previous livestream for a second. Also, it seems TrackPlayer.play(); is first resuming the previous track and then skips and plays the next track. This is the behavior you mentioned, right? |
I have the same problem,if only use skip can work just the pre stream playing state |
I am facing the same issue, has anyone found a solution for it? |
My workaround is adding the upcoming tracks, and then adding the previous tracks afterwards. Like so...
|
@bradleyflood the approach is good, but that would not make the songs play as they appear on the UI, if the library plays the next song automatically it would not be the next song to the last played song on the UI if this issue is not fixed, I might be forced to write my own library for RN audio from scratch 😃 |
@Amusa-Paulos My workaround plays exactly as shown in the UI, that's the whole point of it :) |
okay @bradleyflood I will give it a try |
another workaround could be to reset player and add all items and skip to that index
|
I experienced the same while trying to play one song out of queue, here is my solution maybe it will help you:
|
@puckey any chance that your #1713 PR addresses this iOS bug? I ask because I see:
in your PR, which makes me wonder if I see some people are using UPDATE: hmm, I wonder if you're describing the root of the issue here: doublesymmetry/SwiftAudioEx#14 (comment) |
Hi, please somebody can look in to this issue? it was there from 2022 Oct :( |
@bradleyflood thanks for sharing your workaround! Were you able to figure out why adding a track to the queue results in multiple network requests? I've been running into an issue where playing a track is delayed by 1-3 seconds because |
Hey @tjkyner nah I never got to the bottom of it. But it sounds like work by Puckey and others will fix it in upcoming versions. |
Hi @ninacoder-info you could look into it ;) We are all just as busy. Cheers :) |
@bradleyflood could you verify if this issue has been fixed in |
Yo :) Tried reverting my code to test this today, but couldn't simulate it! hah. I think it only happens in TestFlight and Production versions. So I'll test it in an upcoming TestFlight build. |
@bradleyflood are you ok if we consider this resolved? Additionally for anyone else looking to bypass RNTP's native Queue/Playlist functionality please use the newly introduced |
@jspizziri happy to close if this is confirmed fixed. I haven't got capacity at the moment to test it sorry. |
In my scenario, when I add a new track and skip to it, or when I skip forward/backward and play, the track player will first play for some seconds then skip and play the right song. If anyone doesn't want to use reset() as a workaround to avoid the race condition, here's my solution:
|
@ianniu does this still happen for you in the nightly release of react-native-track-player? |
I haven't upgraded it. I'm using 3.2. |
@ianniu are you able to try the nightly and see if this issue is fixed? |
Sorry, I'm not able to do that for now. |
@bradleyflood @ianniu as far as I have been able to tell, the issue no longer happens for me with the nightly branch. I no longer hear the first episode in the queue play briefly after an episode later in the queue begins to play. So I think it is fixed, but I also made this patch change around the same time (add |
Considering this fixed. |
Describe the Bug
CONTEXT: In our App (using RNTP), a User can browse a Playlist and tap on any Song in that Playlist to begin playing the Song (from that position in the Playlist). In our code when a User taps Play on a Song we first
reset()
the player, then weadd()
all the Songs from the Playlist into the Queue, then weskip(index)
to the Index of the Song they have chosen (eg they might want to start at Song 3 of 10), then weplay()
.We found a bug on iOS where some users were hearing a momentary playback of the first Song in the Queue, BEFORE the
skip(index)
andplay()
had been called.Upon further investigation, by monitoring my local file server, I can see that when adding Tracks into the Queue, there is a network request to fetch the first track in the queue, and then it is momentarily played audibly, even before the
play()
method is triggered.Steps To Reproduce
Note: This appears to only happen on faster/newer devices. Reproduced on a physical iPhone 13 Pro running iOS 16, and on the simulator.
Code To Reproduce
Observe HTTP logs..
Replicable on Example App?
Can you replicate this bug in the React Native Track Player Example App?
Yes.
Environment Info:
main
branch ofreact-native-track-player
as of today.How I can Help
I'm wondering if this "fetch" and short "play" is triggered by the
resolveImportedPath()
method inadd()
being called here https://github.com/doublesymmetry/react-native-track-player/blob/main/src/trackPlayer.ts#L97 (which also explains why the first artwork is fetched too). However, looking at that code I would expect a request for all tracks, because that code loops through them all, but I only ever see a network request for the First track (during theadd()
step).Regardless, there should not be any audio played until
play()
is fired, so there seems to be an issue somewhere.Thoughts?
The text was updated successfully, but these errors were encountered: