JWPlayer 和 HLS 流媒体 - "Error loading player: No playable sources found"
JWPlayer and HLS streaming - "Error loading player: No playable sources found"
问题
我有一个服务器(nginx-rtmp-module)从 IP 摄像机流式传输到 HLS。
我想将直播嵌入流行的浏览器:Chrome、Firefox 和 IE。
流在某些桌面浏览器上不工作。
我试过的
测试的设备和浏览器:
- PC 上的 Firefox - "Error loading player: No playable sources found"
- IE 11 - 正常
- Chrome 在 PC 上 - OK
- Chrome 在 Android - 确定
- iPhone - 好的
问题
如何解决这些问题?在桌面浏览器上进行实时 HLS 流式传输是否需要闪存?
似乎由于混合内容而失败。您的页面位于 https,但 jwplayer 的 url 位于 http.
能不能都放到https下再试试?
我在前一段时间工作的一个项目中遇到了同样的问题。为了解决不支持 RTMP 的浏览器上的问题,我添加了带有 MP4 文件的回退源:
sources: [{
file: "rtmp://example.com/application/mp4:myVideo.mp4"
},{
file: "https://example.com/assets/myVideo.mp4"
}]
文档:https://support.jwplayer.com/customer/portal/articles/1430358-using-rtmp-streaming
在联系了 jwpplayer 支持和一些源代码挖掘之后,我弄清楚了一些事实。
Flash 不一定是实时流式传输的要求,但目前在 Chrome 和 Firefox(除了 IE)中是 HLS 播放的要求。 Chrome自带内置版本的Flash,所以除非故意禁用,否则应该可以播放HLS流,无需下载安装Flash Player。但是,Firefox 和 IE 需要安装 Flash Player。
在我的机器上,IE 11 可以正常运行,但 Firefox 失败并显示消息 "Error loading player: No playable sources found"(因为缺少 Flash 插件)。所以我添加了一些 JavaScript 来显示正确的消息。
swfobject.js 需要库才能工作:http://github.com/swfobject/swfobject
jwplayer.key="<<-THE-KEY->>";
var player = jwplayer("video_container").setup({
file: "http://domain.lt/live/stream.m3u8",
androidhls: true,
width: '100%',
aspectratio: '16:9',
autostart: 'true',
stretching: 'fill'
});
player.onSetupError(function(error)
{
if (swfobject.getFlashPlayerVersion().major == 0)
{
var message = 'Flash is missing. Download it from <a target="_blank" href="http://get.adobe.com/flashplayer/" class="underline">Adobe</a>. (uncheck "McAfee Security Scan Plus" and "True Key™ by Intel Security" )</p>';
$("#video_container").hide();
$("#video_callout").html(message);
} else
{
var message = '<p>Your device is not supported. Please visit this page on another PC or Phone.</p>';
$("#video_container").hide();
$("#video_callout").html(message);
}
});
这可能取决于您使用的播放器。到目前为止,我在 Flowplayer 上运气不错,并且能够在 Chrome 中没有 Flash Player 插件的情况下播放实时流(相反,它使用 MSE 来渲染 HLS 流)。在 Windows 10 上使用 IE11 结果相同,但在 Windows 7 机器上,HLS 流由 Adobe Flash Player 呈现(就像在早期版本的 IE 中一样)。 Firefox 仍然存在问题:v45 具有 MSE 支持,但由于片段加载错误而无法正确处理 HLS。看起来这个问题之前已经发现,希望很快就会得到解决。
问题
我有一个服务器(nginx-rtmp-module)从 IP 摄像机流式传输到 HLS。 我想将直播嵌入流行的浏览器:Chrome、Firefox 和 IE。
流在某些桌面浏览器上不工作。
我试过的
测试的设备和浏览器:
- PC 上的 Firefox - "Error loading player: No playable sources found"
- IE 11 - 正常
- Chrome 在 PC 上 - OK
- Chrome 在 Android - 确定
- iPhone - 好的
问题
如何解决这些问题?在桌面浏览器上进行实时 HLS 流式传输是否需要闪存?
似乎由于混合内容而失败。您的页面位于 https,但 jwplayer 的 url 位于 http.
能不能都放到https下再试试?
我在前一段时间工作的一个项目中遇到了同样的问题。为了解决不支持 RTMP 的浏览器上的问题,我添加了带有 MP4 文件的回退源:
sources: [{
file: "rtmp://example.com/application/mp4:myVideo.mp4"
},{
file: "https://example.com/assets/myVideo.mp4"
}]
文档:https://support.jwplayer.com/customer/portal/articles/1430358-using-rtmp-streaming
在联系了 jwpplayer 支持和一些源代码挖掘之后,我弄清楚了一些事实。
Flash 不一定是实时流式传输的要求,但目前在 Chrome 和 Firefox(除了 IE)中是 HLS 播放的要求。 Chrome自带内置版本的Flash,所以除非故意禁用,否则应该可以播放HLS流,无需下载安装Flash Player。但是,Firefox 和 IE 需要安装 Flash Player。
在我的机器上,IE 11 可以正常运行,但 Firefox 失败并显示消息 "Error loading player: No playable sources found"(因为缺少 Flash 插件)。所以我添加了一些 JavaScript 来显示正确的消息。
swfobject.js 需要库才能工作:http://github.com/swfobject/swfobject
jwplayer.key="<<-THE-KEY->>";
var player = jwplayer("video_container").setup({
file: "http://domain.lt/live/stream.m3u8",
androidhls: true,
width: '100%',
aspectratio: '16:9',
autostart: 'true',
stretching: 'fill'
});
player.onSetupError(function(error)
{
if (swfobject.getFlashPlayerVersion().major == 0)
{
var message = 'Flash is missing. Download it from <a target="_blank" href="http://get.adobe.com/flashplayer/" class="underline">Adobe</a>. (uncheck "McAfee Security Scan Plus" and "True Key™ by Intel Security" )</p>';
$("#video_container").hide();
$("#video_callout").html(message);
} else
{
var message = '<p>Your device is not supported. Please visit this page on another PC or Phone.</p>';
$("#video_container").hide();
$("#video_callout").html(message);
}
});
这可能取决于您使用的播放器。到目前为止,我在 Flowplayer 上运气不错,并且能够在 Chrome 中没有 Flash Player 插件的情况下播放实时流(相反,它使用 MSE 来渲染 HLS 流)。在 Windows 10 上使用 IE11 结果相同,但在 Windows 7 机器上,HLS 流由 Adobe Flash Player 呈现(就像在早期版本的 IE 中一样)。 Firefox 仍然存在问题:v45 具有 MSE 支持,但由于片段加载错误而无法正确处理 HLS。看起来这个问题之前已经发现,希望很快就会得到解决。