mirror of
https://github.com/aditya-K2/gspt.git
synced 2026-01-09 13:58:05 -05:00
playback wrappers
This commit is contained in:
28
gspotify/play.go
Normal file
28
gspotify/play.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package gspotify
|
||||
|
||||
import (
|
||||
"github.com/zmb3/spotify/v2"
|
||||
)
|
||||
|
||||
func play(options *spotify.PlayOptions) error {
|
||||
return Client.PlayOpt(ctx(), options)
|
||||
}
|
||||
|
||||
func PlaySong(uri spotify.URI) error {
|
||||
return play(&spotify.PlayOptions{
|
||||
URIs: []spotify.URI{uri},
|
||||
})
|
||||
}
|
||||
|
||||
func PlaySongWithContext(context *spotify.URI, position int) error {
|
||||
return play(&spotify.PlayOptions{
|
||||
PlaybackContext: context,
|
||||
PlaybackOffset: &spotify.PlaybackOffset{Position: position},
|
||||
})
|
||||
}
|
||||
|
||||
func PlayContext(context *spotify.URI) error {
|
||||
return play(&spotify.PlayOptions{
|
||||
PlaybackContext: context,
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user