Playing A Playlist
Wraps around this Spotify API endpoint
Warning
This method requires Spotify Premium, and will NOT work without Spotify Premium (see here)
Note
If an active device is not found, an error about the response status code not being 2xx will be thrown.
How to use
After getting a playlist through either Spotify.Playlists.GetPlaylist()
or creating a new playlist with Spotify.Playlists.CreatePlaylist()
(And adding tracks to the playlist), the .Play()
method of the playlist object can be used.
.Play()
will start playing the playlist on the active device.
Example
A) Create a new (empty and private) playlist named Test 123
with the description This is an example playlist made by Spotify.ahk
by calling Spotify.Playlists.CreatePlaylist()
B) Get a track object with Spotify.Tracks.GetTrack()
and the track's Spotify ID
C) Add a track to the new playlist with .AddTrack()
, and the newly created track object
D) Will try to play the new playlist on the active device
NewPlaylist := Spotify.Playlists.CreatePlaylist("Test 123", false, "This is an example playlist made by Spotify.ahk")
TheTrack := Spotify.Tracks.GetTrack("5ogtb9bGQoH8CjZNxmbNHR")
NewPlaylist.AddTrack(TheTrack)
NewPlaylist.Play()