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

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -