在正确加载视频之前,Jwplayer会闪烁“错误加载播放器:无法加载播放器配置”一秒钟。我只是觉得这看起来不专业,我花了很多时间寻找如何抑制错误或隐藏它,直到视频完成加载。
在Chrome或Safari等浏览器中,您常常看不到错误,因为它太快了,但是在Firefox中,每次都会看到错误。
下面是我要说的内容的现场演示:
有什么建议,我可以尝试使它,使用户永远不会看到这个错误?
谢谢!
发布于 2015-12-16 12:15:43
发生此错误的原因是JW对象直接添加到HTML页面中,而且没有适当的配置参数。这不是嵌入JW player的正确方法:
<div id="videoplayer_wrapper" class="embed-responsive embed-responsive-16by9">
<object type="application/x-shockwave-flash" data="/jw6.12/jwplayer.flash.swf" bgcolor="#000000" id="video-object" name="video-object" class="embed-responsive-item jwswf swfPrev-beforeswfanchor0 swfNext-afterswfanchor0" tabindex="0">
<param name="allowfullscreen" value="true">
<param name="allowscriptaccess" value="always">
<param name="seamlesstabbing" value="true">
<param name="wmode" value="opaque">
</object>
</div>尝试用以下方法替换您拥有的内容:
<div id="videoplayer_wrapper" class="embed-responsive embed-responsive-16by9">
<div id="video-object"></div>
</div>发布于 2015-12-09 09:38:17
您可以使用JW的onSetup和onError选项为这些场景提供图像。如下所示:
<div id="playerWrapper">
<div id="player"></div>
</div>
<script>
jwplayer('player').setup({
file:'file.mp4',
image:'placeholderImage.jpg',
abouttext: 'Welcome',
aboutlink: 'http://example.com',
width: '100%',
bufferlength: 3,
primary: 'html5',
stretching: 'uniform',
aspectratio: '16:9',
autostart: 'true',
events: {
onError: function () {
$('playerWrapper').html('<img src="error.jpg" style="width:100%;height:100%;" />');
},
onSetupError: function () {
$('playerWrapper').html('<img src="error.jpg" style="width:100%;height:100%;" />');
}
},
ga: {}
)};
</script>https://stackoverflow.com/questions/33903312
复制相似问题