Add Device Menu

This commit is contained in:
aditya-K2
2023-04-15 00:59:57 +05:30
parent d741fcac45
commit b96539f4e5
3 changed files with 45 additions and 1 deletions

View File

@@ -297,3 +297,16 @@ func Search(s string) (*spotify.SearchResult, error) {
spotify.SearchTypeTrack|
spotify.SearchTypeArtist)
}
func UserDevices() ([]spotify.PlayerDevice, error) {
return Client.PlayerDevices(ctx())
}
func TransferPlayback(deviceId spotify.ID) error {
s, err := GetPlayerState()
if err != nil {
return errors.New("Unable to get Current Player State!")
}
err = Client.PauseOpt(ctx(), &spotify.PlayOptions{DeviceID: &s.Device.ID})
return Client.TransferPlayback(ctx(), deviceId, true)
}