Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
shuffle/randomize playlist/set tracks in Soundcloud Widget eg.
require(["lib/play-manager"], function(a) {
// via
//+ Jonas Raoni Soares Silva
//@ [v1.0]
function shuf(o) { for(var j, x, i = o.length; i; j = Math.floor(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x); }
var c = a.getCurrentSound(), p = c ? c.isPaused() : false;
a.playNext(); a.playPrev(); // poor man's refresh of current playing song
if (p) a.pause(c); // preserve first-run state
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment