javascript - Spotify App Preview API Access model.player properties -
i've been playing around latest spotify preview api i'm having issues accessing player properties. im trying current track playing. test snippet below.
require([ '$api/models', '$api/search#search', '$views/image#image' ], function(models,s, image) { 'use strict'; console.log(models.player.track) });
however undefined in console.log seen can access methods. please have @ link reference http://developer.spotify.com/technologies/apps/docs/preview/api/api-models-player.html
found
so before can access player properties must call 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); }); });
Comments
Post a Comment