简体   繁体   English

怎么玩.m3u8流在phonegap Android中使用jwplayer?

[英]How to play .m3u8 Stream Using jwplayer in phonegap Android?

i am using phonegap for http live streaming i am using jwplayer for it. 我正在使用phonegap进行http直播,我正在使用jwplayer。

here is the code for it.. 这是它的代码..

 <div id='mediaplayer1'> 
                <script type="text/javascript">  jwplayer('mediaplayer1').setup({
                   'id': 'playerID', 'width': '388',    'height': '218',
                'provider': 'rtmp',  
                 'streamer': 'rtmp://myserver/chk',
                'autostart': 'true',
                'stretching': 'exactfit',

                        levels: [{
                                   bitrate: "800",
                                   file: "file-super",
                                   width: "1280"
                               }],    
                'modes': [
                       {type: 'flash', src: 'http://www.myserver.com/jwplayer/player.swf'},
                       {
                         type: 'html5',
                         config: {
                          levels: [ {'file': 'http://myserver/playlist.m3u8'} ],
                          'provider': 'video'
                         }
                       }
                   ]
                 });</script>

                    </div>

and in head 在头上

<script src="jwplayer.js" type="text/javascript"></script>

i want to play .m3u8 url. 我想玩.m3u8网址。 some times video play for about 1 or 2 sec. 有时候视频播放约1或2秒。 and automatically stops. 并自动停止。 and some times show warning no playable resource found. 有时候会显示警告没有找到可播放的资源。 how to resolve this. 如何解决这个问题。 is there any good example/tutorial for it. 它是否有任何好的示例/教程。

Thanks in advance.. 提前致谢..

Use Vitamio Player it can play all kind of streaming also its open source,. 使用Vitamio Player它可以播放所有类型的流媒体也是它的开源。 u just need to include this as library into ur project and make sure to use vitamio videoview or mediaplayer,. 你只需要将它作为库包含到你的项目中,并确保使用vitamio videoview或mediaplayer。 k no worry take a look at this Sample to include Vitamio into ur project k不用担心看看这个样本将Vitamio包含在你的项目中

Hope its Helps you,. 希望它能帮助你。

Simply the streaming video can be opened up in a child browser or in App browser to play the video. 只需流媒体视频可以在子浏览器或App浏览器中打开以播放视频。 This solution will work both on Android as well as iOS. 此解决方案既适用于Android,也适用于iOS。

Also if the streaming will be opened in the browser it will appear in full screen mode as q media player will play the video on safari. 此外,如果流媒体将在浏览器中打开,它将以全屏模式显示,因为q媒体播放器将在safari上播放视频。

Hope this will help. 希望这会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM