bsiddiqui
bsiddiqui

Reputation: 1926

Using SoundCloud Getters

I'm having trouble using the SoundCloud getter getCurrentSound(callback). I'm trying to store the song currently in the widget as a var so I can pass that as a param to one of my ruby methods.

I have tried the following and it's not working:

   var current song =  SC.Widget("sc-widget").getCurrentSound() 

Here is info about the getters SoundCloud uses: http://developers.soundcloud.com/docs/api/html5-widget

Upvotes: 0

Views: 523

Answers (1)

Paul Osman
Paul Osman

Reputation: 4117

Sorry if the documentation doesn't make this clear. The getCurrentSound() method is asynchronous, so it does not return a value and instead takes a callback. Try this instead:

var widget = SC.Widget(...);
widget.getCurrentSound(function(sound) {
    console.log(sound.title);
});

Hope that helps. Let me know if it's still unclear.

Upvotes: 2

Related Questions