ensure casting playback stops when quitting app
This commit is contained in:
@@ -31,10 +31,11 @@ const (
|
||||
)
|
||||
|
||||
type playbackCommand struct {
|
||||
Type playbackCommandType
|
||||
Arg any
|
||||
Arg2 any
|
||||
Arg3 any
|
||||
Type playbackCommandType
|
||||
Arg any
|
||||
Arg2 any
|
||||
Arg3 any
|
||||
OnDone func()
|
||||
}
|
||||
|
||||
// playbackCommandQueue is a queue to accumulate player commands from the UI
|
||||
@@ -65,6 +66,13 @@ func (c *playbackCommandQueue) Stop() {
|
||||
playbackCommand{Type: cmdStop})
|
||||
}
|
||||
|
||||
func (c *playbackCommandQueue) StopAndWait() {
|
||||
done := make(chan struct{})
|
||||
c.filterCommandsAndAdd([]playbackCommandType{cmdContinue, cmdPause, cmdStop},
|
||||
playbackCommand{Type: cmdStop, OnDone: func() { close(done) }})
|
||||
<-done
|
||||
}
|
||||
|
||||
func (c *playbackCommandQueue) Continue() {
|
||||
c.filterCommandsAndAdd([]playbackCommandType{cmdContinue, cmdPause, cmdStop},
|
||||
playbackCommand{Type: cmdContinue})
|
||||
|
||||
Reference in New Issue
Block a user