Track Objects
Wrap around this Spotify API object model.
Note
Track objects should only be created with .Tracks.GetTrack()
unless they are returned by, or included in other objects.
Track objects have the SpotifyAPIBaseClass base class, which provides many properties as pseudo properties.
This will have little/no impact on functionality, but it is still recommended you read the SpotifyAPIBaseClass page to understand how this could impact your code.
Properties
Key | Value description |
---|---|
album | An Album Object of the album the track is from |
artists | An array of Artist Objects that represents the Artist(s) of the track |
Pseudo Properties
Key | Value description |
---|---|
available_markets | An array of country codes that the track can be played in |
disc_number | The disc number the track is on (defaults to 1 when an album has no specific discs) |
duration_ms | How long the track is in milliseconds |
duration | Alias for duration_ms |
explicit | If the track has explicit lyrics or not (false = unknown) |
external_ids | A External ID object containing other IDs of the track |
external_urls | A External URL object containing external URLs for the track |
href | A web API endpoint that can be used to get a full version of the track if needed |
id | The Spotify ID of the track |
name | The name of the track |
popularity | A 0-100 scale of how popular Spotify thinks the track is |
preview_url | A link to a 30 second .mp3 preview of the track (can be null) |
track_number | The number of the track on disc, should be used with disc_number |
type | The string "track" |
uri | The Spotify URI of the track |
is_local | If the track is a local track or not |
Methods
Definition | Description |
---|---|
.IsSaved() |
Checks if the track is saved to the user's Your Music library |
.Save() |
Saves a track to the current user's Your Music library |
.UnSave() |
Removes a saved track from the current user's Your Music library |
.Play() |
Tries to start playing the track on the active device, will cancel any other playback |