UPDATE: It seems like it is blowing up on this line:
$('#ytplayerid').load('test.php?track=' + single);
the contents of test.php are:
<script type="text/javascript">
// <![CDATA[
// allowScriptAccess must be set to allow the Javascript from one
// domain to access the swf on the youtube domain
var params = { allowScriptAccess: "always", bgcolor: "#cccccc" };
// this sets the id of the object or embed tag to 'ytplayerid'.
// You then use this id to access the swf and make calls to the player's API
var atts = { id: "ytplayerid" };
swfobject.embedSWF("http://www.youtube.com/v/<?php echo $_GET['track']; ?>?border=0&enablejsapi=1&playerapiid=ytplayer&autoplay=1&showinfo=0","ytplayerid", "180", "145", "8", null, null, params, atts);
//]]>
</script>
My web applications works perfect in Chrome, Safari, and FF; however, IE works the first time you click play all or when you click play a track to play and then throws an error:
Message: Invalid argument. Line: 4075 Char: 5 Code: 0 URI: http://code.jquery.com/jquery-latest.js
http://thinkitpostit.com/tubalr/playlist.php?playlist_id=25 Thats a link to a playlist of mine you can create your own by registering and logging in :)
Any help resolving this problem will be greatly appreciated.
I'm not sure if my code is causing this or what but I will post my JS:
<script type="text/javascript">
$(document).ready(function() {
$('#addbutton').click(function() {
$('#addform').slideToggle('slow')
});
$('.show').mouseover(function() {
$(this).children(".hide").css("display", "inline");
}).mouseout(function() {
$(this).children(".hide").css("display", "none");
});
});
var tracks = new Array();
var numoftracks;
var currenttrack;
var repeat = "off";
var playingSingle;
var single;
function playTrack(track) {
$('.hrshow').show();
single = track;
playingSingle = "yes";
$('#ytplayerid').load('test.php?track=' + single);
}
function playPlaylist(trackstemp) {
$('.hrshow').show();
playingSingle = "no"
trackstemp = trackstemp.split(' ');
for (i=0; i < trackstemp.length; i++){
tracks[i] = trackstemp[i];
}
numoftracks = tracks.length - 1;
currenttrack = 0;
$('#ytplayerid').load('test.php?track=' + tracks[currenttrack]);
}
function onYouTubePlayerReady(playerId) {
ytplayer = document.getElementById("ytplayerid");
ytplayer.addEventListener("onStateChange", "onytplayerStateChange");
}
function onytplayerStateChange(newState) {
if (newState == 0) {
if (playingSingle == "no") {
currenttrack += 1;
if ((currenttrack == numoftracks) && (repeat == "on")) {
currenttrack = 0;
$('#ytplayerid').load('test.php?track=' + tracks[currenttrack]);
}
else {
$('#ytplayerid').load('test.php?track=' + tracks[currenttrack]);
}
}
if ((playingSingle == "yes") && (repeat == "on")) {
$('#ytplayerid').load('test.php?track=' + single);
}
}
}
function toggleRepeat() {
if (repeat == "off") {
$('#repeatimg').attr("src","design/repeaton.png");
repeat = "on";
}
else {
$('#repeatimg').attr("src","design/repeatoff.png");
repeat = "off";
}
}
</script>