这是indexloc提供的服务,不要输入任何密码
Skip to content

Making Player.Play() Non-Blocking or Easily Interruptible #270

@mattn

Description

@mattn

I'm using the oto library to play audio in a Go application, but I've noticed that calling Player.Play() appears to block the calling goroutine until the entire audio finishes playing (or at least for a significant duration). According to the documentation, Play() should be non-blocking and asynchronous, returning immediately while playback happens in the background. However, in illegal case, it seems to halt execution unexpectedly, for example, passing illegal audio stream.

https://github.com/mattn/nhk-radio/blob/418448c60efbd6d5ce735db86235cc8cd9092dbe/main.go#L539-L545

OS: Windows 11 Home
Go version: go version go1.25.0 windows/amd64

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions