尝试使用 iFrame 和 Firefox 4.0 无法加载视频来解决此问题 这是我目前的代码。我试图查看这个网站 - https://developer.mozilla.org/en/HTML/HTML5/Optimizing_Your_Pages_for_Speculative_Parsing寻求帮助。但这对我来说意义不大。
任何帮助将不胜感激
问候马特
<div id="myVid"></div>
<script>
var tag = document.createElement('script');
tag.src = "http://www.youtube.com/player_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
var player;
function onYouTubePlayerAPIReady() {
player = new YT.Player('myVid', {
height: '80%',
width: '100%',
events: {
'onReady': onPlayerReady,
'onStateChange': onPlayerStateChange
}
});
}
function onPlayerReady(event) {
event.target.playVideo();
}
function onPlayerStateChange(event) {
if (event.data == YT.PlayerState.ENDED) {
getVideo();
}
}
</script><