Below is the code I use for nice YouTube video effect on http://tinyurl.com/caa4bsb
and it works on all browsers except Safari and I simply can’t see what the problem is.
If it’s impossible or very hard to fix in Safari, then how do I set HTML to be displayed if browser is Safari? (I would simply use normal non-auto-playing video for Safari without overlaying button for sound).
<button type="button" id="clicktheplayer" onclick="playlongmovie();"></button>
<div id="ytplayer" style="width:399px; height:225px">
<p>You will need Flash 8 or better to view this content.</p>
</div>
</div>
<script type="text/javascript">
var params = {
allowScriptAccess: "always",
'wmode': 'opaque'
};
swfobject.embedSWF("http://www.youtube.com/v/ryTH6Ta3qSY?enablejsapi=1&playerapiid=ytplayer&autoplay=1&rel=0", "ytplayer", "399px", "225px", "8", null, null, params);
function onYouTubePlayerReady() {
var ytplayer = document.getElementById("ytplayer");
ytplayer.mute();
}
function playlongmovie() {
var ytplayer = document.getElementById("ytplayer");
ytplayer.unMute();
ytplayer.seekTo(0, true);
$("#clicktheplayer").hide();
}
</script>