Skip to content

Detecting end of audio playback #3351

@derat

Description

@derat

Operating System

  • Windows
  • macOS
  • Linux
  • FreeBSD
  • OpenBSD
  • Android
  • iOS
  • Nintendo Switch
  • PlayStation 5
  • Xbox
  • Web Browsers

What feature would you like to be added?

It would be nice to have some way to reliably detect the completion of audio playback, i.e. when audio.Player receives io.EOF while reading from its io.Reader.

Right now, I'm attempting to detect this state by repeatedly polling IsPlaying() and waiting for it to become false without me having called Pause() to intentionally stop playback, but this feels imprecise compared to e.g. having a channel I could read for events.

Why is this needed?

This would make it easier to start playing a new music track immediately after one finishes.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions