JWPlayer and HLS streaming - “Error loading player: No playable sources found”

こ雲淡風輕ζ 提交于 2019-12-05 21:28:24

After contacting jwpplayer support and some source code digging, I figured out some facts.

Flash is not necessarily a requirement for live streaming but it is currently a requirement for HLS playback in Chrome and Firefox (in addition to IE). Chrome has its own built-in version of Flash, so unless it was deliberately disabled, it should play the HLS stream without needing to download and install the Flash Player. However, Firefox and IE would need the Flash Player installed.

On my machine IE 11 was working, but Firefox failed with message "Error loading player: No playable sources found" (because of missing Flash plugin). So I added some JavaScript to display correct message.

swfobject.js library is required for this to work: 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);
    }   
});

It seems that is failing due to mixed content. You've got your page on https but the jwplayer's url is on http.

Could you put all under https and try again?

I've got the same problem on one of the projects I've worked for a while time ago. To solve issues on browsers which does not support RTMP I've added fallback source with MP4 file:

sources: [{ 
    file: "rtmp://example.com/application/mp4:myVideo.mp4"
},{
    file: "https://example.com/assets/myVideo.mp4"
}] 

Documentation: https://support.jwplayer.com/customer/portal/articles/1430358-using-rtmp-streaming

It might depend on what player you are using. I've had good luck so far with Flowplayer and was able to play live streams without the Flash Player plug-in in Chrome (instead, it uses MSE to render the HLS streams). Same result using IE11 on Windows 10, though on a Windows 7 machine, the HLS stream was rendered by the Adobe Flash Player (as it was in earlier versions of IE). Firefox remains a problem: v45 has MSE support, but failed to handle HLS properly because of fragment loading errors. It looks like this problem has been previously identified and hopefully will be addressed soon.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!