Skip to content

Instantly share code, notes, and snippets.

@vschmidt94
Created November 16, 2014 01:25
Show Gist options
  • Select an option

  • Save vschmidt94/ad77bbc75732bb876be7 to your computer and use it in GitHub Desktop.

Select an option

Save vschmidt94/ad77bbc75732bb876be7 to your computer and use it in GitHub Desktop.
Just an example for R.M.
function playSomeSound(genre) {
SC.get('/tracks', {
genres: genre
//bpm: {
//from: 100
// }
}, function(tracks) {
var random = Math.floor(Math.random() * 49);
SC.oEmbed(tracks[random].uri, { auto_play: true}, document.getElementById('target'));
});
}
window.onload = function() {
SC.initialize({
client_id: 'aa5d8a1cce870da1549c30eb44e5cb4b'
});
var menuLinks = document.getElementsByClassName('genre');
for (var i = 0; i < menuLinks.length; i++) {
var menuLink = menuLinks[i];
menuLink.onclick = function(e) {
e.preventDefault();
playSomeSound(menuLink.innerHTML);
};
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment