Im trying to start a specific track using spotify API, but no matter what i do, i can't seem to get it to work. I don't understand the documentation and where to place the track index.
here is the API documentation: https://developer.spotify.com/docs/apps/api/1.0/api-models-player.html
require(['$api/models'], function(models) {
models.player.playContext(models.Playlist.fromURI('spotify:user:cevil:playlist:5f4EBgrnSf86Hr86kL4S90:index:5'));
});
The playContext documentation states that the method takes four parameters, the second one being the index.
The first item in the context to play. This must be a positive number. If left out, the first playable item in the context will start playing.
Using your code snippet:
require(['$api/models'], function(models) {
var index = 2;
models.player.playContext(models.Playlist.fromURI('spotify:user:cevil:playlist:5f4EBgrnSf86Hr86kL4S90'), index);
});
The index starts from 0, so this example would play the third track in the playlist.