-
-
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
Playback queue ended Trigger twice #1243
Comments
only in iphone. android is OK |
same problem +1 |
It should definitely be triggered after playing the last item, this sounds like a bug. |
You can use lodash/debounce to fix this one. const handlePlaybackQueueEndedDebounce = debounce(function(){ // to do something },500) |
Resolved but we can continue the conversation in #1349 |
I am currently using v2.2.0-rc2 which includes this fix but I am still seeing the event get fired twice on iOS: once upon reaching the last track and once when the queue has actually ended. This is the exact same bug I was experiencing with v2.1.2 before I upgraded. |
Describe the bug
"Playback queue ended" monitoring is always called twice in a row, and each time it is the penultimate in my playback queue. It will be triggered after playing. Personally, I think it should be triggered after playing the last one
To Reproduce
Steps to reproduce the behavior:
Environment (please complete the following information):
react-native-track-player 2.0.3
Code
TrackPlayer.addEventListener('playback-queue-ended', async () => {
const queue = await TrackPlayer.getQueue();
const id = await TrackPlayer.getCurrentTrack();
console.log('******** remote-ended ********', id, queue);
if (queue && queue.length - 1 == id) {
await Player.next();
}
});
The text was updated successfully, but these errors were encountered: