Last active
August 16, 2017 16:44
-
-
Save ChristopherHackett/86b18700bfac1b3e90693317d95d2463 to your computer and use it in GitHub Desktop.
soundcloud
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
var elem = document.createElement('script'); | |
elem.src = "https://w.soundcloud.com/player/api.js"; | |
elem.type = "text/javascript"; | |
var scpt = document.getElementsByTagName('script')[0]; | |
scpt.parentNode.insertBefore(elem,scpt); | |
}()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
var widgetIframe = document.querySelector('iframe[src*="api.soundcloud.com"]') | |
var widget = SC.Widget(widgetIframe); | |
widget.bind(SC.Widget.Events.READY, function() { | |
widget.bind(SC.Widget.Events.PLAY, function() { | |
widget.getCurrentSound(function(currentSound) { | |
console.log('sound ' + currentSound.get('') + 'began to play'); | |
}); | |
}); | |
}); | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment