audioplayers icon indicating copy to clipboard operation
audioplayers copied to clipboard

onPlayerComplete isn't working on Android in Loop mode

Open define-private-public opened this issue 2 years ago • 3 comments

Checklist

  • [X] I read the troubleshooting guide before raising this issue
  • [X] 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

define-private-public avatar Oct 17 '23 04:10 define-private-public

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

Gustl22 avatar Oct 26 '23 15:10 Gustl22

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 avatar May 02 '24 03:05 songyang-dev

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

songyang-dev avatar May 15 '24 01:05 songyang-dev