Created
May 26, 2017 17:52
-
-
Save dave-4k/9839d682e7f7ad92f96c06f8e53f96d3 to your computer and use it in GitHub Desktop.
Play Next With SoundCloud HTML5 API
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
/** | |
* Play Next With SoundCloud HTML5 API | |
*/ | |
body { padding: 20px 20px 0; background-color: #eaeaea;}iframe { display: block; width: 728px; margin: 0 auto 20px; box-shadow: 0 0 6px -1px #ddd; background: #fff; border: 2px solid #fff; border-radius: 5px;} |
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
<iframe width="100%" height="166" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/132387987&auto_play=false"></iframe> | |
<iframe width="100%" height="166" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/268605105&auto_play=false"></iframe> |
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
var $players = $('iframe[src*="soundcloud"]') , i = 0 ;$players.wrap('<div class="my-soundcloud"></div>');$players.each(function () { $(this).attr('data-local-soundcloud-player-id', i); i = i + 1;});if ( $players.length > 0 ) { $.getScript('//w.soundcloud.com/player/api.js', function (data, status) { if ( status === 'success' ) { $players.each(function (index) { var sc = SC.Widget(this); sc.bind(SC.Widget.Events.READY, function() { sc.bind(SC.Widget.Events.FINISH, function () { if(index < $players.length - 1){ SC.Widget($players[index + 1]).play(); } }); }); }); } });} |
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
{"view":"separate","fontsize":"100","seethrough":"","codespector_bootstrap":"","codespector_jquery":"","page":"all"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment