问题所在
我有一个服务器(nginx-rtmp-模块),它从IP摄像机流到HLS。我想将实时流嵌入到流行的浏览器: Chrome、Firefox和IE。
该流在某些桌面浏览器上不起作用。
我试过的
经测试的设备和浏览器:
问题
如何解决这些问题?flash是桌面浏览器上实时HLS流的要求吗?
发布于 2016-05-12 10:49:34
在联系了jwpplayer支持和一些源代码挖掘之后,我发现了一些事实。
Flash不一定是直播流的要求,但它目前是Chrome和Firefox (除了IE之外) HLS播放的一项要求。Chrome有自己的内置版本的Flash,所以除非故意禁用,否则它应该不需要下载和安装Flash播放器就可以播放HLS流。然而,Firefox和IE需要安装Flash。
在我的机器IE 11上工作,但火狐失败的消息“错误加载播放器:找不到可玩的来源”(因为缺少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);
}
});发布于 2016-05-11 09:12:16
由于内容参差不齐,这似乎正在失败。您已经在https上找到了您的页面,但是jwplayer的url在http上。
你能把所有的都放在https下面然后再试一次吗?
发布于 2016-05-11 09:25:13
我在一段时间前工作过的项目中也遇到了同样的问题。为了解决浏览器上不支持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
https://stackoverflow.com/questions/37157739
复制相似问题