Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Signaling player state changes / finishing instead of polling player.IsPlaying() #246

Open
vsariola opened this issue Oct 6, 2024 · 0 comments
Milestone

Comments

@vsariola
Copy link
Contributor

vsariola commented Oct 6, 2024

The examples show how to wait for player being finished as

for player.IsPlaying() {
  time.Sleep(time.Millisecond)
}

This smells badly. What is needed is players to signal something like a EOF, probably through a channel, so that waiting for the player to be finished could be done with something like

<-playerFinished

Alternatively, a sync.WaitGroup might be appropriate, with 1 counter. Player could have method Wait() just calling the Wait() method of the sync.WaitGroup. Then any number of goroutines / threads could wait for the player to be finished.

@hajimehoshi hajimehoshi modified the milestones: v3.3.0, v3.4.0 Oct 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants