javascript Jwplayer 无法在 Chrome 中播放视频
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20339383/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Jwplayer can't play video in Chrome
提问by eddard.stark
This is my first time using Jwplayer. I am trying to play a video using Jwplayer. The code I have written works in Firefox, IE, Opera but not in Chrome.
这是我第一次使用 Jwplayer。我正在尝试使用 Jwplayer 播放视频。我编写的代码适用于 Firefox、IE、Opera,但不适用于 Chrome。
It is saying "error loading media : file cannot be played". My code is given below. I am also using CodeIgniter and Bootstrap.
它说“错误加载媒体:无法播放文件”。我的代码如下。我也在使用 CodeIgniter 和 Bootstrap。
<section class="row">
<div class="col-md-12">
<div id="ad-video">Loading the player...</div>
</div>
</section>
$(document).ready(function(){
jwplayer("ad-video").setup({
file: "http://vatiali.com/assets/videos/choc.mp4",
image: "http://vatiali.com/assets/images/black.jpg"
});
});
回答by Neil Girardi
I don't think that is the correct fix. I think that is a workaround which is masking the true problem.
我认为这不是正确的解决方法。我认为这是一种掩盖真正问题的解决方法。
The default setting for primary playback mode is HTML5. When operating with the default setting JWPlayer should automatically fallback to playing the video with flash if the browser does not support HTML playback for the video file and the Flash plugin is installed.
主要播放模式的默认设置是 HTML5。使用默认设置运行时,如果浏览器不支持视频文件的 HTML 播放并且安装了 Flash 插件,JWPlayer 应自动回退到使用 Flash 播放视频。
I suspect that your JWPlayer implementation only works with Flash.
我怀疑您的 JWPlayer 实现仅适用于 Flash。
Please test your implementation on a browser that does not have Flash installed but supports HTML5 playback of the video type you are using. I suspect it will not work.
请在未安装 Flash 但支持您正在使用的视频类型的 HTML5 播放的浏览器上测试您的实现。我怀疑这行不通。
To further troubleshoot this please revert the primary setting to the default, open the JavaScript console, refresh the page and tell us what error you see.
要进一步解决此问题,请将主要设置恢复为默认设置,打开 JavaScript 控制台,刷新页面并告诉我们您看到了什么错误。
Here's a guess as to what the problem might be. Is the jwplayer.html5.js file located in the same directory as the jwplayer.js file? If not you can use the 'html5player' option t specify the location of the file.
这是对问题可能是什么的猜测。jwplayer.html5.js 文件是否与 jwplayer.js 文件位于同一目录中?如果没有,您可以使用 'html5player' 选项指定文件的位置。
回答by carterh062
I had to set the option for primary to 'flash' for my jwplayer setup. The code looks like
我必须为我的 jwplayer 设置将主要选项设置为“闪烁”。代码看起来像
video_player_jw.setup({
file: $('#source_url').val(),
height: 360,
width: 640,
primary: 'flash'
});
I am only doing this in chrome as it works fine with primary as html5 in all other browsers.
我只在 chrome 中这样做,因为它在所有其他浏览器中与主要的 html5 一起工作正常。