有一个网站产生间歇性错误。到目前为止主要是在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 - loadeddata event never fires
使用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>
我有点难过,而且“我大部分时间都不习惯”。
答案 0 :(得分:0)
您似乎正在处理一个非常过时的videojs版本。我一直在使用它的最新版本之一,并修改了一些东西。我的编辑功能允许您点击移动设备视频缩略图上的任意位置,而不是完全位于中心。它还允许自适应视频= http://www.andy-howard.com/recreate-bbc-iplayer/index.html