Charbarred
Charbarred

Reputation: 21

API Returning Various Artist while Player Displays Artist Name

When I play a track that has more than one artist, the Spotify player will show the names of the artists but the API will just return "Various Artists".

An example would be this track: http://open.spotify.com/track/1UhqsS2W93LhBQtA0q9x0x The Spotify player shows Michael Stipe; Asha Bostle

When I use the code below, I get Various Artists for the artist:

var playerTrackInfo = player.track;
var track = playerTrackInfo.data;
var artist = track.album.artist.name;

Is there an alternative way to retrieve the artist that will actually return Michael Stipe and Asha Bostle instead of "Various Artists"?

Upvotes: 0

Views: 103

Answers (1)

iKenndac
iKenndac

Reputation: 18776

The track object has an artists property that contains an array of Artist objects:

var track = player.track;
var artists = track.artists;

Documentation here.

Upvotes: 1

Related Questions