通过JQuery在html5视频中更改源代码在IE9中不起作用
问题:通过jQuery更改HTML5视频的源元素会在IE9中引发错误 这是我的jQuery函数,用于更改视频源:通过JQuery在html5视频中更改源代码在IE9中不起作用,jquery,html,html5-video,Jquery,Html,Html5 Video,问题:通过jQuery更改HTML5视频的源元素会在IE9中引发错误 这是我的jQuery函数,用于更改视频源: var hdswipe = function(){ var currVid, currExt, currVidName, currQuality, i, tempExt; if($hdVideo.attr('paused')==false) playerstage=1;
var hdswipe = function(){
var currVid, currExt, currVidName, currQuality, i, tempExt;
if($hdVideo.attr('paused')==false)
playerstage=1;
currVid = $hdVideo[0].currentSrc;
currExt = currVid.substr(currVid.lastIndexOf('.') + 1);
for(i=0; i<videoAttr.quality.length; i++) //Get current video quality
if(currVid == videoAttr.src[i])
currQuality=videoAttr.quality[i];
for(i=0; i<videoAttr.quality.length; i++) //Swipe the Video
{
tempExt = videoAttr.src[i].substr(videoAttr.src[i].lastIndexOf('.') + 1);
if((currExt==tempExt)&&(currQuality!= videoAttr.quality[i]))
{
$hdVideo.attr('src', videoAttr.src[i]);
createSeek();
createBuffer();
playerstage=0;
gPlay();
break;
}
}
if(currQuality == "sd")
$("a.hd-hd-swipe-button").addClass("hd-hd-swipe-button-hd");
else
$("a.hd-hd-swipe-button").removeClass("hd-hd-swipe-button-hd");
return false;
}
错误消息是:
$hdVideo.attr('buffered').end(0)中未定义的函数
但是缓冲功能工作正常,因为我一直播放视频,直到调用“hdswipe”功能
请解决我的问题。我想您应该尝试使用以下语法:
$hdVideo[0].buffered.end(0);
嘿@Armel Larcier,它再次显示了相同的错误。在这个问题上你还有其他想法吗?
$hdVideo[0].buffered.end(0);