bluefireteam/audioplayers

onPlayerComplete isn't working on Android in Loop mode

define-private-public opened this issue · 3 comments

Checklist

  • I read the troubleshooting guide before raising this issue
  • I made sure that the issue I am raising doesn't already exist

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
// ... 
    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

  • Android: Pixel 6 Pro w/ Android 14

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

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

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.

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