after extensive research i couldn't find an answer that fitted my (fairly) low skills in javascript. it'd be a great relief if any of you could help.
i'm trying to run this script twice on the same page but i think the problem is the function onYouTubePlayerReady cannot be called two times without having it overwritten by the last. Also, if I change its name the actual functions won't be performed.
here's the code. I'd like it to play up to 4 youtube videos with no sound and autoplay in the same page. do you know how it's possible?
thanks for your time
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Prova 1</title>
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script type="text/javascript">
google.load("swfobject", "2.1");
</script>
</head>
<body align="center">
<div id="ytapiplayer2"></div>
<script type="text/javascript">
function onYouTubePlayerReady2(playerId2) {
ytplayer2 = document.getElementById("myytplayer2");
ytplayer2.playVideo();
ytplayer2.mute();
}
var videoID2 = "OFIhzSwDfwo"
var params = { allowScriptAccess: "always" };
var atts = { id: "myytplayer2" };
swfobject.embedSWF("http://www.youtube.com/v/" + videoID2 + "?enablejsapi=1&playerapiid=ytplayer\
&autoplay=1&version=3&showinfo=0&iv_load_policy=3&controls=0&modestbranding=1",
"ytapiplayer2", "250", "inherit", "0", null, null, params, atts)
</script>
<div id="ytapiplayer"></div>
<script type="text/javascript">
function onYouTubePlayerReady(playerId) {
ytplayer = document.getElementById("myytplayer");
ytplayer.playVideo();
ytplayer.mute();
}
var videoID = "e5iqtQLm-BM"
var params = { allowScriptAccess: "always" };
var atts = { id: "myytplayer" };
swfobject.embedSWF("http://www.youtube.com/v/" + videoID + "?enablejsapi=1&playerapiid=ytplayer\
&autoplay=1&version=3&showinfo=0&iv_load_policy=3&controls=0&modestbranding=1",
"ytapiplayer", "250", "inherit", "0", null, null, params, atts)
</script>
</body>
</html>