以下是我在http://tinyurl.com/caa4bsb上用于获得精彩YouTube视频效果的代码 它适用于除Safari之外的所有浏览器,我根本无法看到问题所在。
如果在Safari中无法修复或很难修复,那么如果浏览器是Safari,如何设置HTML? (我只是在Safari中使用普通的非自动播放视频而不会覆盖声音按钮。)
<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>