Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
907 views
in Technique[技术] by (71.8m points)

cordova - 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 )

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!)

However I keep getting the "Error loading player: no playable sources found" error when implementing the JWplayer in android. 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:

 <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? As mentioned the application is a PhoneGap application.

Thanks!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

JW Player does not support Flash on Android anymore, as a response to Adobe also dropping Android Flash support. Only HTML5 (and therefore only MP4/WebM) are supported, as of Android 2.3.

HTTP Live Streaming indeed has limited support for HTML5 in Android. 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).

The best solution to streaming on Android is leveraging an SDK that supports HLS for your native app. Several companies offer such an SDK (e.g. devicedrm.com or nexstreaming.com). I don't know whether such solutions would work with Phonegap though.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...