Javascript 视频无法在internet explorer 6上运行
我的视频可以在除IE6之外的所有浏览器上运行,我不知道为什么会这样Javascript 视频无法在internet explorer 6上运行,javascript,jquery,html,Javascript,Jquery,Html,我的视频可以在除IE6之外的所有浏览器上运行,我不知道为什么会这样 <div class="video_box"> <div id="ytplayer"></div> <div class="video_ratio"></div> <div class="play_controls"> <a hr
<div class="video_box">
<div id="ytplayer"></div>
<div class="video_ratio"></div>
<div class="play_controls">
<a href="#" class="play_pause"><span class="fa fa-pause"></span></a>
<a href="#" class="play_me_audio">Play with audio</a>
</div>
</div>
</div>
我的html文件是这样的
<div class="video_box">
<div id="ytplayer"></div>
<div class="video_ratio"></div>
<div class="play_controls">
<a href="#" class="play_pause"><span class="fa fa-pause"></span></a>
<a href="#" class="play_me_audio">Play with audio</a>
</div>
</div>
</div>
我的JS文件是这样的,我知道这是正确的,因为它可以在其他浏览器上工作。我能做些什么来让它在InternetExplorer6上工作
<div class="video_box">
<div id="ytplayer"></div>
<div class="video_ratio"></div>
<div class="play_controls">
<a href="#" class="play_pause"><span class="fa fa-pause"></span></a>
<a href="#" class="play_me_audio">Play with audio</a>
</div>
</div>
</div>
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/player_api?version=3";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
var player;
function onYouTubePlayerAPIReady() {
player = new YT.Player('ytplayer', {
height: '100%',
width: '100%',
playerVars: { 'rel':0 , 'loop':1, 'controls':0, 'start':0, 'autohide':1,'wmode':'opaque','modestbranding':1,'showinfo':0,'playlist':'mjSLiluF_gk' },
videoId: 'mjSLiluF_gk',
events: {
'onReady': onPlayerReady,
'onStateChange': onPlayerStateChange}
});
}
function onPlayerReady(event) {
event.target.mute();
if(window['YOUTUBE_AUTOPLAY'] == undefined) window['YOUTUBE_AUTOPLAY'] = true;
if(window['YOUTUBE_AUTOPLAY'] && !mobilecheck()) event.target.playVideo();
}
p_state = -1;
function onPlayerStateChange(event) {
p_state = event.data;
switch (event.data)
{
case 1:
case 3:
$('.play_pause .fa').addClass('fa-pause').removeClass('fa-play');
break;
case 2:
$('.play_pause .fa').addClass('fa-play').removeClass('fa-pause');
break;
}
}
$('.play_me_audio').click(function(){
if (player.isMuted())
{
player.unMute();
$(this).text('Play muted');
player.setLoop(['mjSLiluF_gk'],false);
}
else
{
$(this).text('Play with audio');
player.mute();
}
return false;
});
$('.play_pause').click(function(){
if (p_state == 1)
{
player.pauseVideo();
}
if (p_state < 1 || p_state == 2)
{
player.playVideo();
}
return false;
});
您不应该添加对ie 6的支持。。。事实上,没有人在我们的网站日志上使用它。使用ie6IE6的访问量每月达到近2万次。自2010年以来,谷歌不再支持IE6。但我知道有时候你必须让它工作。。。当检测到浏览器为IE6时,我建议您使用Flash Player?这样,您就可以在插件中运行视频,而不会与此二战浏览器中的javascript发生冲突