有一个产生间歇性错误的网站。到目前为止,主要是在 Chrome 中。视频大部分时间加载,但我会说大约 10-15% 的时间,没有加载,我在控制台中记录了一个错误。出错后刷新页面通常可以解决问题。
错误:
["Video Error", Object]
0: "Video Error"
1: Object
AT_TARGET: 2
BLUR: 8192
BUBBLING_PHASE: 3
Bb: function c(){return f}
CAPTURING_PHASE: 1
CHANGE: 32768
CLICK: 64
DBLCLICK: 128
DRAGDROP: 2048
FOCUS: 4096
KEYDOWN: 256
KEYPRESS: 1024
KEYUP: 512
MOUSEDOWN: 1
MOUSEDRAG: 32
MOUSEMOVE: 16
MOUSEOUT: 8
MOUSEOVER: 4
MOUSEUP: 2
NONE: 0
SELECT: 16384
bubbles: false
cancelBubble: true
cancelable: true
clipboardData: undefined
currentTarget: video#my_video_1_html5_api.vjs-tech
defaultPrevented: false
eventPhase: 2
initEvent: function initEvent() { [native code] }
mc: function d(){return l}
preventDefault: function (){e.preventDefault&&e.preventDefault();a.returnValue=l;a.zb=c}
relatedTarget: undefined
returnValue: true
srcElement: video#my_video_1_html5_api.vjs-tech
stopImmediatePropagation: function (){e.stopImmediatePropagation&&e.stopImmediatePropagation();
stopPropagation: function (){e.stopPropagation&&e.stopPropagation();a.cancelBubble=f;a.Bb=c}
target: video#my_video_1_html5_api.vjs-tech
timeStamp: 1375812343815
type: "error"
which: undefined
zb: function d(){return l}
__proto__: Object
length: 2
__proto__: Array[0]
我不能从中得到什么。
我遇到了这个线程,但主要修复似乎涉及移动代码,我没有改变行为。Video.js - 加载数据事件永远不会触发
Javascript:
_V_("my_video_1").ready(function(){
var myPlayer = this;
sizeVideo(); //used to adjust my canvas so it fits in design based of screen width
myPlayer.play();
});
function sizeVideo(){
var viewSizeWidth=$('.video_wrapper').width();
var viewSizeHeight=parseInt(viewSizeWidth/1.7791);
var videoWrapperHeight=parseInt($('.video_wrapper').height());
$('#my_video_1 ').width(viewSizeWidth);
$('#my_video_1 ').height(viewSizeHeight);
$('#my_video_1 video').width(viewSizeWidth);
$('#my_video_1 video').height(viewSizeHeight);
if(viewSizeHeight> videoWrapperHeight ){
var heightOffset=(viewSizeHeight-videoWrapperHeight)/2;
$('#my_video_1 video').css('top','-' + heightOffset + 'px');
$('.video_wrapper').height(700);
}else{
$('#my_video_1 video').css('top','0px');
$('.video_wrapper').height(viewSizeHeight);
}
}
html
<video id="my_video_1" class='video-js vjs-default-skin' preload="auto" data-setup='{"controls": false,"loop":"true"}' autoplay poster='/img/video-placeholder.jpg'>
<source src="/vid/corp.mp4" type='video/mp4'>
<source src="/vid/corp.ogv" type='video/ogg'>
<source src="/vid/corp.webm" type='video/webm'>
</video>
我有点难过,我对它“大部分时间”的工作不太满意。