title: YouTube Playlists - Shuffle/Random Function
body: <p>Is there any way to embed a YouTube playlist that has the ability to shuffle or randomise on the page reload? So, it starts showing one video in the playlist and plays from that point and then when the browser is refreshed, it plays another and so forth.</p>
  
  <p>I can do this fairly well with a xml and third party video tool that allows me to play XMLs with a random function, but a lot of the videos in the playlist has copyrighted music so has to be played through the YouTube embed or it won't work.</p>
  
  <p>Any ideas? I've tried to do this for months and months.</p>
  
  <p>I've attached some code below with what sort of works, which I embedded using an iFrame, but it causes IE to constantly refresh and fill up my access logs to the point where it crashes.</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;/head&gt;
  &lt;body onLoad="load()" style="background-color:white"&gt;
  &lt;script type="text/javascript"&gt;
  var playlisturl = "http://gdata.youtube.com/feeds/api/playlists/D4607BD824235A91?v=2";
  var playlisturls = ["http://gdata.youtube.com/feeds/api/playlists/D4607BD824235A91?v=2"];
  var pause_playlist_text = "Pause playlist (loop current video)";
  var embed = true;
  var swf = false;
  var autoplay = false;
  var vwidth = 275;
  var vheight = 270;
  &lt;/script&gt;
  &lt;script type="text/javascript" src="http://youtube-playlist-randomizer.valami.info/seedrandom.js.pagespeed.ce.FBW5lks-2H.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="http://youtube-playlist-randomizer.valami.info/playlist-min.js.pagespeed.ce.mjzbqx3nYo.js"&gt;&lt;/script&gt;
  &lt;object style="width: 275px; height: 270px"&gt;
    &lt;param name="movie" value="http://www.youtube.com/v/Yo6dgBCsj2Q?version=3"&gt;
    &lt;param name="allowFullScreen" value="true"&gt;
    &lt;param name="allowScriptAccess" value="always"&gt;
    &lt;embed id="myytplayer" src="http://www.youtube.com/v/Yo6dgBCsj2Q?enablejsapi=1&amp;version=3" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="275px" height="270px"&gt;
  &lt;/object&gt;
  
  &lt;p&gt;&lt;button class="sexybutton sexysimple sexyblue" id="previousbutton" onClick="previous()"&gt;&lt;span class="prev"&gt;Previous&lt;/span&gt;&lt;/button&gt;
  &lt;button class="sexybutton sexysimple sexyblue" id="nextbutton" onClick="next()"&gt;&lt;span class="next after"&gt;Next&lt;/span&gt;&lt;/button&gt;&lt;/p&gt;
  &lt;script type="text/javascript"&gt;
  
  document.getElementById('pauseplaylist').style.display = "none"
  
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Many thanks in advance,
  Richard</p>