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.
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.
Any ideas? I've tried to do this for months and months.
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.
<html>
<head>
</head>
<body onLoad="load()" style="background-color:white">
<script type="text/javascript">
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;
</script>
<script type="text/javascript" src="http://youtube-playlist-randomizer.valami.info/seedrandom.js.pagespeed.ce.FBW5lks-2H.js"></script>
<script type="text/javascript" src="http://youtube-playlist-randomizer.valami.info/playlist-min.js.pagespeed.ce.mjzbqx3nYo.js"></script>
<object style="width: 275px; height: 270px">
<param name="movie" value="http://www.youtube.com/v/Yo6dgBCsj2Q?version=3">
<param name="allowFullScreen" value="true">
<param name="allowScriptAccess" value="always">
<embed id="myytplayer" src="http://www.youtube.com/v/Yo6dgBCsj2Q?enablejsapi=1&version=3" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="275px" height="270px">
</object>
<p><button class="sexybutton sexysimple sexyblue" id="previousbutton" onClick="previous()"><span class="prev">Previous</span></button>
<button class="sexybutton sexysimple sexyblue" id="nextbutton" onClick="next()"><span class="next after">Next</span></button></p>
<script type="text/javascript">
document.getElementById('pauseplaylist').style.display = "none"
</script>
</body>
</html>
Many thanks in advance, Richard
There´s an official "randomize" function available if you enable javascript-control on your player. You create an extra button for randomizing.. or create a function to let it randomize depending on date,time.iP-adress...etc. It works..i´m using it, youtube calls it "SHUFFLE" check the Youtube jS-api pages: