Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/392.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Jwplayer闪烁“;加载播放机时出错:无法加载播放机配置“;_Javascript_Jwplayer_Jwplayer6 - Fatal编程技术网

Javascript Jwplayer闪烁“;加载播放机时出错:无法加载播放机配置“;

Javascript Jwplayer闪烁“;加载播放机时出错:无法加载播放机配置“;,javascript,jwplayer,jwplayer6,Javascript,Jwplayer,Jwplayer6,Jwplayer在正确加载视频之前会闪烁“加载播放器时出错:无法加载播放器配置”一秒钟。我只是觉得这看起来不专业,我花了很多时间寻找如何抑制错误或隐藏它,直到视频加载完成 在诸如Chrome或Safari这样的浏览器中,你经常看不到错误,因为它太快了,但在Firefox中,你每次都会看到错误 下面是我所说内容的现场演示: 有什么建议我可以尝试使它这样的用户永远不会看到这个错误 谢谢 您可以使用JW Player的onSetup和onError选项为这些场景提供图像。像这样: <div i

Jwplayer在正确加载视频之前会闪烁“加载播放器时出错:无法加载播放器配置”一秒钟。我只是觉得这看起来不专业,我花了很多时间寻找如何抑制错误或隐藏它,直到视频加载完成

在诸如Chrome或Safari这样的浏览器中,你经常看不到错误,因为它太快了,但在Firefox中,你每次都会看到错误

下面是我所说内容的现场演示:

有什么建议我可以尝试使它这样的用户永远不会看到这个错误


谢谢

您可以使用JW Player的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>

jwplayer('player')。设置({
文件:'file.mp4',
图像:'placeholder image.jpg',
abouttext:“欢迎”,
关于链接:'http://example.com',
宽度:“100%”,
缓冲长度:3,
主要:“html5”,
拉伸:“均匀”,
aspectratio:'16:9',
自动启动:“true”,
事件:{
onError:函数(){
$('playerRapper').html(“”);
},
onSetupError:函数(){
$('playerRapper').html(“”);
}
},
ga:{}
)};

发生此错误是因为您将JW flash对象直接添加到HTML页面的方式,并且没有正确的配置参数。这不是嵌入JW播放器的正确方法:

<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>