do not reload track when changing queue (if possible) #164
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When the user update the queue, Spotify sends a "replace" frame but one issue is that the current (playing) track is being stopped and reloaded which caused and audible gap, especially on esp32.
This PR tries to address the issue when possible, means that when the 1st track of the reloaded frame is still being played, then no reload is done. Of course, why large buffers, the windows when this can be done will be smaller as TrackPlayer quickly moves to streaming the next track and it becomes virtually impossible to distinguish between tracks.
This probably needs a thorough review
[edit]: I did a first version that poke the TrackPlayer to know what it was playing but it was a bit goofy and I think it's better now where the TrackPlayer simply sets a flag on the track it is downloading and if the preloadedTracks[0] has that flag set, then it simply means that we are still on it. Less changes to different places of the code.