start of new simplified player interface

This commit is contained in:
Drew Weymouth
2023-12-21 20:25:52 -08:00
parent 4c3d638aed
commit 0cd58cb51b
2 changed files with 46 additions and 0 deletions
+13
View File
@@ -193,6 +193,19 @@ func (p *Player) ClearPlayQueue() error {
return p.mpv.Command([]string{"playlist-clear"})
}
func (p *Player) SetFile(url string) error {
if !p.initialized {
return ErrUnitialized
}
if err := p.mpv.Command([]string{"stop"}); err != nil {
return err
}
if err := p.mpv.Command([]string{"playlist-clear"}); err != nil {
return err
}
return p.mpv.Command([]string{"loadfile", url, "append"})
}
// Seeks within the currently playing track.
// See MPV seek command documentation for more details.
func (p *Player) SeekSeconds(secs float64) error {