- Joined
- May 8, 2013
- Posts
- 2,515
- Reaction score
- 859
Hi All,
I know there is some programming awesomeness around here so hope you dont mind me asking. Im trying to make a soundcloud widgit api variable global scope, so I can access in another function. Probably simple but cant get my head round it . Heres the souncloud widget api bit:
(function(){
var widgetIframe = document.getElementById('sc-widget'),
widget = SC.Widget(widgetIframe);
widget.bind(SC.Widget.Events.READY, function() {
widget.bind(SC.Widget.Events.PLAY, function() {
getOutput();
// get information about currently playing sound
widget.getCurrentSound(function(currentSound) {
console.log('sound ' + currentSound.get('') + 'began to play');
});
});
// get current level of volume
widget.getVolume(function(volume) {
console.log('current volume value is ' + volume);
});
// set new volume level
widget.setVolume(1.0);
// get the value of the current position
});
}());
I need to get the track name currentSound into a global outside the scope of this function. Any help appreciated.
I know there is some programming awesomeness around here so hope you dont mind me asking. Im trying to make a soundcloud widgit api variable global scope, so I can access in another function. Probably simple but cant get my head round it . Heres the souncloud widget api bit:
(function(){
var widgetIframe = document.getElementById('sc-widget'),
widget = SC.Widget(widgetIframe);
widget.bind(SC.Widget.Events.READY, function() {
widget.bind(SC.Widget.Events.PLAY, function() {
getOutput();
// get information about currently playing sound
widget.getCurrentSound(function(currentSound) {
console.log('sound ' + currentSound.get('') + 'began to play');
});
});
// get current level of volume
widget.getVolume(function(volume) {
console.log('current volume value is ' + volume);
});
// set new volume level
widget.setVolume(1.0);
// get the value of the current position
});
}());
I need to get the track name currentSound into a global outside the scope of this function. Any help appreciated.