简体   繁体   English

在Android中使用JWplayer在Phonegap中流式播放视频

[英]Using JWplayer in Android for streaming video playback in Phonegap

I'm trying to use JWPlayer as a way around Android not supporting HLS playback in Webview in Phonegap (or ar least I can't get it to work, only with WebM streams and the video plugin on https://github.com/macdonst/VideoPlayer , HLS streams give audio only ) 我正在尝试使用JWPlayer作为Android的一种方式,以不支持Phonegap的Webview中的Webview中的HLS播放(或者至少我无法使其正常工作,仅适用于WebM流和https://github.com/上的视频插件macdonst / VideoPlayer ,HLS流仅提供音频)

I know the user needs flash installed but at the moment what's most importart for me is to get either the RTMP or HLS (.m3u8) displayed on the device (2.3, 4.0 or 4.1, whichever works!) 我知道用户需要安装Flash,但目前对我来说,最重要的是使RTMP或HLS(.m3u8)显示在设备上(2.3、4.0或4.1,以任何一种为准!)。

However I keep getting the "Error loading player: no playable sources found" error when implementing the JWplayer in android. 但是,在android中实现JWplayer时,我一直收到“错误加载播放器:找不到可播放的源”错误。 So far I have only tested in the simulator. 到目前为止,我仅在模拟器中进行了测试。

The code is nothing fancy, in the HTML file after including cordova JS all I do is: 该代码没什么花哨的,在包含cordova JS之后的HTML文件中,我要做的就是:

 <script type="text/javascript" src="jwplayer/jwplayer.js" ></script>
 <script type="text/javascript">jwplayer.key="b+mykey"</script>
 <div id="my-video"></div> 
 <script type="text/javascript">
        jwplayer('my-video').setup({
            flashplayer: "javascripts/lib/jwplayer/player.swf",      
                 streamer: "rtmp://myserveraddressgoeshere",
                 file: "corecctfile.goeshere-sdh",
                 provider:"rtmp",
                 autostart: 'true',
                 controlbar: "over",
                 width: '720',
                 height: '405'
         });</script>

Obviously I have the correct paths but obscured them here for client privacy reasons. 显然,我具有正确的路径,但出于客户端隐私的原因,此处将其遮盖。

Does anyone have an idea as to why this does not work? 有谁知道为什么这不起作用? Or how I can get the RTMP / HLS stream to work on an Android device? 或如何,我可以得到RTMP / HLS流工作在Android设备上? As mentioned the application is a PhoneGap application. 如前所述,该应用程序是PhoneGap应用程序。

Thanks! 谢谢!

JW Player does not support Flash on Android anymore, as a response to Adobe also dropping Android Flash support. JW Player不再支持Android上的Flash,因为对Adobe的响应也取消了对Android Flash的支持。 Only HTML5 (and therefore only MP4/WebM) are supported, as of Android 2.3. 从Android 2.3开始,仅支持HTML5(因此,仅支持MP4 / WebM)。

HTTP Live Streaming indeed has limited support for HTML5 in Android. 实际上,HTTP Live Streaming在Android中对HTML5的支持有限。 It's only playing in 4.0+ and has a few critical bugs: display aspect ratios are not recognised and on-demand HLS streams act like live ones (no timeline; no seeking). 它仅在4.0以上版本中播放,并且存在一些严重的错误:无法识别显示宽高比,按需HLS流的作用类似于实时流(无时间轴;无寻道)。

The best solution to streaming on Android is leveraging an SDK that supports HLS for your native app. 在Android上流式传输的最佳解决方案是利用支持本地应用程序HLS的SDK。 Several companies offer such an SDK (eg devicedrm.com or nexstreaming.com). 多家公司提供了这样的SDK(例如devicedrm.com或nexstreaming.com)。 I don't know whether such solutions would work with Phonegap though. 我不知道这种解决方案是否可以与Phonegap一起使用。

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

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