audioplayers
audioplayers copied to clipboard
onPlayerCompletion is getting called twice
1 - Start Playlist from First Song. 2 - On Song complete it triggers OnPlayerCompletion. 3 - OnPlayerCompletion will call next song in index. 4 - By the time Future call is getting complete the onPLayerCompletion again gets called. 5 - This causes skipping 1 song, i tried adding state check but it always return as completed as the earlier play call is not yet finished.
Finally found a workaround. Below is my code, based on duration i am blocking second call after onPlayerCompletion. Let me know your thoughts if this approach has any side effect or impact?
audioPlayer.onPlayerCompletion.listen((event) { setState(() { if ((duration.inSeconds >= position.inSeconds) && position.inSeconds > 0) {
What is duration and Position? Not work well in my case.
What is duration and Position? Not work well in my case.
Duration is the entire length in time of the song while position is the current time of the song which is playing, usually returned by onAudioPositionChanged
On which platforms do you experience this? Can you check, is this still a thing with 1.x.x? Thx :)
Closing as stale.