【问题标题】:JWPlayer 7 error "cannot load m3u8 crossdomain access denied" chrome only win 10JWPlayer 7 错误“无法加载 m3u8 跨域访问被拒绝”chrome only win 10
【发布时间】:2017-11-07 20:49:47
【问题描述】:

在 pc windows 10 Firefox 和 Edge 上加载正常。仅限铬! “无法加载 m3u8:跨域访问被拒绝”

JWPlayer HTML 代码

<script> var playerInstance = jwplayer('Player'); playerInstance.setup({ primary: 'flash', file: 'http://example/playlist.m3u8', image: "//example/example.png", title: "example" }); </script>

跨域.xml

<cross-domain-policy>
  <allow-access-from domain="*" secure="false"/>
  <allow-http-request-headers-from secure="false" headers="*" domain="*"/>
</cross-domain-policy>

【问题讨论】:

  • jwplayer 7.x 版本是什么?
  • Jwplayer 7.11.0

标签: javascript google-chrome cross-domain m3u8 jwplayer7


【解决方案1】:

您需要设置流文件的CORS头...

Access-Control-Allow-Origin:*

这是一种类似于 Flash 的机制。

您可以在 hls.js 演示页面上测试您的 CORS HLS 流:http://video-dev.github.io/hls.js/demo/

关于CORS:https://enable-cors.org/

【讨论】:

  • 感谢您的快速响应,我在您推荐的网站 (video-dev.github.io/hls.js/demo) 上用 chrome 测试了 m3u8 流,流加载良好嗯
  • 如果您只尝试使用“文件”参数,它是否有效?前任。 playerInstance.setup({ file: 'example/playlist.m3u8' });
  • var playerInstance = jwplayer('Player'); playerInstance.setup({ file: 'http://-/playlist.m3u8', }); 现在只能在边缘工作!
  • 你有 jwplayer 'premium' 许可证吗?
【解决方案2】:

抱歉回复晚了

我已找到问题的答案 URL 缺少端口号 (http://exsamle.com:0000/my/stream.m3u8)

【讨论】:

    猜你喜欢
    • 2020-02-06
    • 2011-04-05
    • 2010-12-26
    • 1970-01-01
    • 2018-04-05
    • 1970-01-01
    • 1970-01-01
    • 2016-03-02
    • 1970-01-01
    相关资源
    最近更新 更多