bluefireteam / audioplayers

A Flutter package to play multiple audio files simultaneously (Android/iOS/web/Linux/Windows/macOS)
https://pub.dartlang.org/packages/audioplayers
MIT License
2k stars 844 forks source link

onPlayerComplete isn't working on Android in Loop mode #1675

Open define-private-public opened 1 year ago

define-private-public commented 1 year ago

Checklist

Current bug behaviour

I added a a few listeners to my instance of AudioPlayer.onPlayerComplete stream. When playback has finished for a track, the event is being fired off for all platforms (Linux, macOS, iOS) except Android.

Expected behaviour

On Android, the handler I created for the AudioPlayer.onPlayerComplete event should be called when a track has reached the end.

With the snippet below, the Done message is printing on the console for all of the platforms except for Android.

Steps to reproduce

I am using a local MP3 file.

Code sample

Code sample ```dart // ... var player = AudioPlayer(); player.setReleaseMode(ReleaseMode.loop); player.onPlayerComplete.listen(_on_playback_done); // .. void _on_playback_done(final void _) async { print(''All done!'); if (!loop_track) { // And reset the player back to the end await player.pause(); await player.seek(Duration.zero); } } ```

Affected platforms

Android

Platform details

AudioPlayers Version

5.2.0

Build mode

debug

Audio Files/URLs/Sources

No response

Screenshots

No response

Logs

No response

Related issues / more information

No response

Working on PR

no way

Gustl22 commented 11 months ago

This is on loop mode only right? Then it probably needs adapting to the other platforms. But we currently transitioning to exoplayer in the near future, see #1526

songyang-dev commented 5 months ago

I am experiencing a similar issue on Android, but my release mode is stop. The audio works as intended on iOS but not on Android.

songyang-dev commented 5 months ago

Are you using this in low latency mode? It was the reason why it didn't work on my end. Low latency mode on Android does not support events