video on demand streamin with jwplayer wowza android issue

女生的网名这么多〃 提交于 2019-12-10 13:30:01

问题


I try to make jwplayer work on android phone when I put rtsp protocol file source it work fine in android but display an error that file can not be played in iOS and PC

without rtsp file source work on pc and iOS fine with rtsp file source work only in android

jwplayer("mediaplayer").setup({
            playlist: [{
                sources: [
                        {file:'rtmp://localhost:1935/vod/mp4:dexter.mp4'}//used it to PC ,
                        {file:'rtsp://localhost:1935/dexter/dexter.mp4'}// used it to android,
                        {file:'http://localhost:1935/vod/mp4:dexter.mp4/playlist.m3u8'}//and this for iOS                       
                        ],
                title: 'dexter',

        width: 854,
        height: 480,
    });

回答1:


I have Solved the issue by checking if the device is android or not

 var ua = navigator.userAgent.toLowerCase();
    var isAndroid = ua.indexOf("android") > -1;
    jwplayer("mediaplayer").setup({
        playlist: [{
            sources: [
                    (isAndroid)?{file:'rtsp://localhost:1935/vod/dexter/dexter.mp4'}:{file:'rtmp://localhost:1935/vod/mp4:dexter/dexter.mp4'},
                    {file:'http://localhost:1935/vod/mp4:dexter.mp4/playlist.m3u8'}                     
                    ],
    title: 'dexter',
    width: 854,
    height: 480,
});



回答2:


You can't put RTSP inside of the setup(), block, since neither Flash or HTML5 supports it.

You should do the work around mentioned here - http://www.longtailvideo.com/support/jw-player/28856/using-apple-hls-streaming

HLS Live on Android

For live streams, there's not yet a good solution for playback on Android or other non-iOS mobile platforms. One workaround is to offer a native app for Android, in which HLS streams can be supported. This is beyond the scope of JW Player though. Another option, if you use the Wowza Media Server, is to offer a fallback RTSP stream for devices that don't support HLS. For example:

<div id="myElement">
    <a href="rtsp://example.com/vod/mp4:myVideo.mp4">watch this stream over RTSP</a>
</div> 

jwplayer("myElement").setup({
    file: "http://example.com:1935/vod/mp4:myVideo.mp4/playlist.m3u8",
    image: "/assets/myPoster.jpg",
    fallback: false
});



回答3:


What no one seems to mention is the awful latency that HLS brings to the table with is "chunk video", it can be 30 seconds, if you are doing real-time streaming, like video surveylance, the RTMP and RTSP are the better solutions. RTSP works well on iOS & Android through VLC with 1 to 2 seconds of latency.



来源:https://stackoverflow.com/questions/17568993/video-on-demand-streamin-with-jwplayer-wowza-android-issue

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