toggle
This commit is contained in:
parent
bafaa8a941
commit
338bef9f75
@ -3,10 +3,10 @@ package commands
|
|||||||
func (c *Commander) TogglePlay() error {
|
func (c *Commander) TogglePlay() error {
|
||||||
state, err := c.Client().PlayerState(c.Context)
|
state, err := c.Client().PlayerState(c.Context)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return c.Play()
|
||||||
}
|
}
|
||||||
if state.Playing {
|
if state.Playing {
|
||||||
return c.Client().Pause(c.Context)
|
return c.Pause()
|
||||||
}
|
}
|
||||||
return c.Client().Play(c.Context)
|
return c.Play()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user