3

What I am trying to achieve is doing live streaming via Android device. After testing, prior version 4.3, devices are playing live streamings using HLS .m3u8 properly. An example source code is as follow:

<video controls="controls" style="height:400px; width:320px;">
    <source src="/hls-live/my-stream_/my-stream_,1360,500,.m3u8"></source>
</video>

<a href="/hls-live/my-stream_/my-stream_,1360,560,.m3u8">Direct Link<a/>

As you can see above, I'm trying to use HTML5 video tag to render the stream. It won't play in browser, however, if you click the direct link with the exact same path, a player will pop up and the stream will play correctly.

So I am a bit confused here as why the live can't be player properly under the html5 player, but able to play in a popup player (I assume the later is a native player under Android?)

Environment:

  • Android OS 4.3
  • ASUS Nexus 7
  • Chrome browser

EDIT: Some more information added here, I've also tried other type of video, for example http://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov/playlist.m3u8 from this page http://www.wowza.com/forums/showthread.php?32675-HLS-playback-issue-on-Android-4-3. So replace this m3u8 with the one in <source> tag and the Chrome browser will play it ok. If looking into the working m3u8, you can see the codecs is avc1.66.30, mp4a.40.2, which I suspect that the actual codec of the files is the cause of the issue.

I've also tried to call media.canPlayType('application/vnd.apple.mpegURL') and it returns an empty string.

Yudong Li
  • 1,784
  • 2
  • 17
  • 32
  • more information needed. which is your device? – Raptor Feb 07 '14 at 04:02
  • I'm currently running test via a ASUS Nexus 7, with 4.3 OS. – Yudong Li Feb 07 '14 at 04:05
  • and you're working in an App (using `WebView`) or in the phone browser (if yes, which browser are you using? default one / others?) – Raptor Feb 07 '14 at 04:08
  • I'm not building any apps and I'm just build a HTML page using the Chrome browser. – Yudong Li Feb 07 '14 at 04:09
  • lots of people reported this issue: https://www.google.com.hk/search?q=hls+android+4.3&oq=hls+android+4.3&aqs=chrome..69i57j69i60l3.4233j0j7&sourceid=chrome&espv=210&es_sm=91&ie=UTF-8 – Raptor Feb 07 '14 at 04:26
  • I've done the same search, and cannot find an exact same issue. Also, what makes me more confusing is why Chrome cannot play it but after clicking the link a popup player can play properly. Aren't they under the same browser engine? – Yudong Li Feb 07 '14 at 04:30
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/46983/discussion-between-yudong-li-and-shivan-raptor) – Yudong Li Feb 07 '14 at 04:31

1 Answers1

0

I think the reason that it works via directly from the browser but fail through video tag is that the cross origin proxy ( safari just doesn't have this limit for HSL).

Make sure you add Access-Control-Allow-Origin: * to your .m3u8 and .ts file, it should work

Neekey
  • 4,065
  • 1
  • 15
  • 9