Ankit
Ankit

Reputation: 4710

CloudFront HLS streaming not working - S3 (HLS v4)

I setup a S3 based HLS streaming using CloudFront, but the HLS streaming doesn't seem to work. I have a created the bucket and transcoded content using this webcast: https://www.youtube.com/watch?v=MuQ_qg7U0l8

The content seems to have the right permissions, but mime types are missing (I see m3u8 to have mime type text/plain. Shouldnt' transcoder set this correctly?

I'm not sure if this is the reason the video doesn't play. In Chrome, it just shows a blank screen using HTML5 tag, and in Safari if i try to play it directly, it shows the play button but nothing else.

Any ideas where to look? My original content was mp4 (before using elastic transcoder)

UPDATE: Ahh seems to be a problem with HLS-v4, works fine if I transcode to HLS-v3. So perhaps not related to mime-type (same mimetypes in v3)

Upvotes: 2

Views: 3002

Answers (2)

thr
thr

Reputation: 183

In my case i was using s3 public bucket, and was not able to stream,

I tried setting the CORS configuration in s3 and it worked fine

I added the following in S3 console CORS configuration( s3 > "public bucket" > permissions > CORS configuration)

 <?xml version="1.0" encoding="UTF-8"?>
 <CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
 <CORSRule>
     <AllowedOrigin>*</AllowedOrigin>
     <AllowedMethod>GET</AllowedMethod>
     <MaxAgeSeconds>3000</MaxAgeSeconds>
 </CORSRule>
 </CORSConfiguration>

for more details this might help you

Upvotes: 0

aergistal
aergistal

Reputation: 31209

I checked your test stream and the mime types are correct:

curl -I http://.../master.m3u8
HTTP/1.1 200 OK
Content-Type: application/x-mpegURL

curl -I http://.../hls_1m_.ts
HTTP/1.1 200 OK
Content-Type: video/MP2T

The stream also plays correctly.

Some clients only support the version 3 of the protocol and I think this is your issue.

Version 4 added byte-range support through EXT-X-BYTERANGE. See your playlist:

#EXTINF:3.754688999999999,
#EXT-X-BYTERANGE:118258@1990168
hls_1m_.ts

This will definitely cause issues with some players which don't support the new features. The safest way is to go with version 3 for now.

Upvotes: 1

Related Questions