在联系了 jwpplayer 支持和一些源代码挖掘之后,我弄清楚了一些事实。
Flash 不一定是实时流媒体的要求,但目前它是 Chrome 和 Firefox(除了 IE)中 HLS 播放的要求。Chrome 有自己的内置 Flash 版本,因此除非故意禁用它,否则它应该播放 HLS 流,而无需下载和安装 Flash Player。但是,Firefox 和 IE 需要安装 Flash Player。
在我的机器上 IE 11 正在运行,但 Firefox 失败并显示消息“加载播放器时出错:找不到可播放的源”(因为缺少 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);
}
});