playback wrappers

This commit is contained in:
aditya-K2
2023-04-08 22:10:19 +05:30
parent 9727d52a8b
commit a4313360a7

28
gspotify/play.go Normal file
View 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,
})
}