Jwplayer 7.0.3闪存18不播放视频,而HTML工作正常

时间:2015-09-21 08:02:08

标签: flash jwplayer jwplayer7

虽然它适用于带有mp4文件的ni html5模式,但播放器在闪光模式下既不播放flv文件,也不在闪光模式下播放mp4文件。在Chrome(44.0.2403.157)和Firefox(40.0.3)中,它无限期地加载。

更奇怪的是,jwplayer仪表板(https://dashboard.jwplayer.com/#/players/basic_setup)中的播放器在使用以下调用从控制台加载flv文件时设法播放flv文件:

jwplayer(document.querySelector('.jwplayer')).load([{ file:'http://www.sample-videos.com/video/flv/720/big_buck_bunny_720p_1mb.flv' }]);

这是一个展示问题的jsfiddle:

https://jsfiddle.net/kLdmj42d/(确保指定许可证密钥)

只需切换mp4和flv文件的注释,以确保它实际上与mp4文件一起使用。

HTML:

<div class="main">
    <div id="player">
    </div>
</div>

JS:

jwplayer.key = "";
jwplayer.defaults = {
  aspectratio: "16:9",
  autostart: false,
  controls: true,
  displaydescription: false,
  displaytitle: true,
  flashplayer: "//ssl.p.jwpcdn.com/player/v/7.0.3/jwplayer.flash.swf",
  height: 260,
  mute: false,
  ph: 1,
  //plugins: {"http://assets-jpcust.jwpsrv.com/player/6/6124956/ping.js": {"pixel": "http://content.jwplatform.com/ping.gif"}},
  primary: "html5",
  repeat: false,
  stagevideo: false,
  stretching: "uniform",
  width: "100%"
};

jwplayer(document.getElementById('player')).setup({
  file: 'http://www.sample-videos.com/video/flv/720/big_buck_bunny_720p_1mb.flv'
  //file: 'http://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_1mb.mp4'
});

我还在JwPlayer的网站上发布了这个问题:http://support.jwplayer.com/customer/portal/questions/14332602-jwplayer-7-3-with-flash-18-not-playing-videos

2 个答案:

答案 0 :(得分:1)

问题是,显然,JwPlayer Flash播放器需要访问window.jwplayer才能正常工作。

但是,显然,使用AMD时,window.jwplayer永远不会设置。

在修复之前,解决方法是在应用的代码中设置window.jwplayer

至于jsfiddle,正如我在评论中所说,由于沙盒iframe,它不起作用。

http://support.jwplayer.com/customer/en/portal/questions/14351203-jwplayer-7-3-with-flash-18-not-playing-videos?new=14351203

答案 1 :(得分:0)

奇怪,虽然这在JS Fiddle中不起作用,当我在本地加载以下内容时,一切正常:

<!DOCTYPE html>
<html>
<head>
    <title>Template</title>
    <script src="http://p.jwpcdn.com/player/v/7.0.3/jwplayer.js" type="text/javascript"></script>
    <script type="text/javascript" language="javascript">jwplayer.key = "YOUR_KEY";</script>
</head>
<body>
    <div id="player"></div>
    <script type="text/javascript" language="javascript">
    jwplayer("player").setup({
        file: "http://www.sample-videos.com/video/flv/720/big_buck_bunny_720p_1mb.flv"
    });
    </script>
</body>
</html>