Reputation: 398
I've been playing around with the latest spotify preview api but I'm having issues accessing the player properties. Im trying to get the current track playing. This is a my test snippet below.
require([
'$api/models',
'$api/search#Search',
'$views/image#Image'
], function(models,s, Image) {
'use strict';
console.log(models.player.track)
});
however I get undefined in the console.log It seen that I can only access the methods. Please have a look at the link for reference http://developer.spotify.com/technologies/apps/docs/preview/api/api-models-player.html
Upvotes: 1
Views: 369
Reputation: 398
Found It
So before you can access the player properties you must call the load method
require([
'$api/models',
'$api/search#Search',
'$views/image#Image'
], function(models,s, Image) {
'use strict';
models.player.load('track').done(function(prop) {
console.log(prop.track.name);
});
});
Upvotes: 2