Playing A Track

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 track object through either Spotify.Tracks.GetTrack() or any other function/object which contains/returns track objects, the .Play() method of the track object can be used.

.Play() will start playing the track on the active device.

Example

This example will:

A) Get a track with Spotify.Tracks.GetTrack() by the track's Spotify ID.

C) Play the track

GoodSongIMO := Spotify.Tracks.GetTrack("4A6eJ3gOmVdD7C69N3DC7K")
GoodSongIMO.Play()

An alternative way to do this without getting the full track object is the Spotify.Player.PlayTrack() method, which takes a track ID, and would save us a single web API call to get the track.

Spotify.Player.PlayTrack("4A6eJ3gOmVdD7C69N3DC7K")