【问题标题】:Jwplayer 7.0.3 with flash 18 not playing videos, while HTML is working fine带有 flash 18 的 Jwplayer 7.0.3 不播放视频,而 HTML 工作正常
【发布时间】:2015-12-17 20:29:53
【问题描述】:

虽然在 html5 模式下播放 mp4 文件效果很好,但播放器在 flash 模式下既不能播放 flv 文件,也不能在 flash 模式下播放 mp4 文件。在 Chrome (44.0.2403.157) 和 Firefox (40.0.3) 中,它会无限期地加载。

更奇怪的是,来自 jwplayer 仪表板 (https://dashboard.jwplayer.com/#/players/basic_setup) 的播放器在使用以下调用从控制台加载 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 文件上的 cmets 以确保它确实适用于 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

【问题讨论】:

    标签: flash jwplayer jwplayer7


    【解决方案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

    【讨论】:

    • 是的,我测试了多个版本,看看问题是否仍然存在。
    【解决方案2】:

    奇怪,虽然这在 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>
    

    【讨论】:

    • 可能是因为 jsfiddle 中有 iframe?
    • 我将页面放在 iframe 中进行测试,完全没有问题 - , page. html 有上面的内容。
    • 奇怪的是,在 Chrome 中,对我来说没有问题,但我确实在 Firefox 中看到了问题,但仅在 JS Fiddle 中。
    • 更正,在 Chrome 中它会缓冲,在 Firefox 中它会显示错误,找不到可播放的源。虽然只是在小提琴中。当您在您的网站上运行播放器时,您是否也遇到过同样的问题?
    • 我在 jsFiddle 中也遇到了与 6.12 相同的问题。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-02
    • 1970-01-01
    • 2012-06-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多