The problem
When I used
<video id="player"
src="http://hlsserver.example/auth/and/get/hls?authkey=42"
controls>
</video>
it failed with videoElement.error == error.MEDIA_ERR_SRC_NOT_SUPPORTED
[1] on Chrome 40, even though Chrome requested the src
URL three times as seen in tcpdump. This is the response from the server:
HTTP/1.1 200 OK
Content-Type: application/vnd.apple.mpegurl
[...]
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="Swedish",AUTOSELECT=YES,DEFAULT=YES,URI="blah",LANGUAGE="swe"
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=500000,SUBTITLES="subs"
/stream-proxy/blah1
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=700000,SUBTITLES="subs"
/stream-proxy/blah2
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1000000,SUBTITLES="subs"
/stream-proxy/blah3
Footnotes
MEDIA_ERR_SRC_NOT_SUPPORTED
has a value of 4
.
The solution
It seems like thoma.ing's answer is correct for Chrome 40 on Android 4.4.4 at least:
Android code (ICS, JB) looks at the URL to determine player selection! If the URL contains the keyword m3u8, then and only then, will it play HLS. This is obviously a bug in Android.
When I changed the video src
URL to include the m3u8
keyword it started working perfectly fine on Chrome.
<video id="player"
src="http://hlsserver.example/auth/and/get/hls?authkey=42&m3u8=yes"
controls>
</video>
.m3u8
, you can passMimeTypes.APPLICATION_M3U8
tosetMimeType
ofMediaItem.Builder
to explicitly indicate the type of the content.」ref