shaka-project / shaka-player

JavaScript player library / DASH & HLS client / MSE-EME player
Apache License 2.0
6.98k stars 1.32k forks source link

HLS manifest parser plugin #279

Closed joeyparrish closed 7 years ago

joeyparrish commented 8 years ago

Initially only for browsers which support MPEG2-TS natively (Safari, Chromecast)

avelad commented 8 years ago

Note: Microsoft Edge also supports MPEG2-TS natively

There will be support for Playready (Edge and Chromecast) and Fairplay (Safari)?

joeyparrish commented 8 years ago

There is already support for Playready on Edge & IE. Playready has not been tested on Chromecast, though.

All DRM is through EME APIs, so any interoperable DRM system in any EME-compliant browser should work. The status of Fairplay through EME is unknown at this time.

avelad commented 8 years ago

So, HLS+Playready will work on Edge(IE has not support for MPEG2-TS without transmuxing)?

joeyparrish commented 8 years ago

We expect so, yes. But we have not begun work yet, so we do not know what interoperability challenges we may find.

avelad commented 8 years ago

HLS supports Fragmented MP4 – and gets MPEG-DASH compatible! https://bitmovin.com/hls-news-wwdc-2016/

joeyparrish commented 8 years ago

Given that new development, I would expect HLS with MP4 to work on almost every browser we support. Again, we haven't started work on HLS yet.

sanbornhilland commented 8 years ago

I thought it could be useful to catalogue some of the issues with building HLS support into Shaka, as I come across them.

1) As reported in #439 a lot of HLS VOD content seems not to start at 0 but it so far seems impossible to know what the start time is of the content until the first segment is downloaded. 2) HLS can include just an audio stream as it's lowest quality stream (see below), the intention being that if your bandwidth drops low enough then the player should switch down to this audio only variant. But it is not an audio stream in the sense that you can choose this audio stream vs some other stream (english vs spanish etc.). It seems to me like this doesn't fit nicely into Shaka's streaming model.

#EXT-X-STREAM-INF:BANDWIDTH=263851,CODECS="mp4a.40.2, avc1.4d400d",RESOLUTION=416x234,AUDIO="bipbop_audio",SUBTITLES="subs"
gear1/prog_index.m3u8
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=28451,CODECS="avc1.4d400d",URI="gear1/iframe_index.m3u8"

#EXT-X-STREAM-INF:BANDWIDTH=577610,CODECS="mp4a.40.2, avc1.4d401e",RESOLUTION=640x360,AUDIO="bipbop_audio",SUBTITLES="subs"
gear2/prog_index.m3u8
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=181534,CODECS="avc1.4d401e",URI="gear2/iframe_index.m3u8"

#EXT-X-STREAM-INF:BANDWIDTH=915905,CODECS="mp4a.40.2, avc1.4d401f",RESOLUTION=960x540,AUDIO="bipbop_audio",SUBTITLES="subs"
gear3/prog_index.m3u8
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=297056,CODECS="avc1.4d401f",URI="gear3/iframe_index.m3u8"

#EXT-X-STREAM-INF:BANDWIDTH=1030138,CODECS="mp4a.40.2, avc1.4d401f",RESOLUTION=1280x720,AUDIO="bipbop_audio",SUBTITLES="subs"
gear4/prog_index.m3u8
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=339492,CODECS="avc1.4d401f",URI="gear4/iframe_index.m3u8"

#EXT-X-STREAM-INF:BANDWIDTH=1924009,CODECS="mp4a.40.2, avc1.4d401f",RESOLUTION=1920x1080,AUDIO="bipbop_audio",SUBTITLES="subs"
gear5/prog_index.m3u8
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=669554,CODECS="avc1.4d401f",URI="gear5/iframe_index.m3u8"

#EXT-X-STREAM-INF:BANDWIDTH=41457,CODECS="mp4a.40.2",AUDIO="bipbop_audio",SUBTITLES="subs"
gear0/prog_index.m3u8
raskri commented 7 years ago

Any news on the ETA for HLS support in Shaka?

joeyparrish commented 7 years ago

We have just scheduled the work for v2.1.0, which we intend to have out at the end of the year. As we make progress, you'll see commits and major milestones mentioned here.

avelad commented 7 years ago

There will be support for.. CEA-608? HLS + AES? HLS + FairPlay(#382)? Live and VoD profiles? What version of HLS (4,5,6,7,..)?

ismena commented 7 years ago

We are just starting investigation and design work at this point. We'll keep this issue up to date with the decisions on what we will and won't support as we get into them.

dougdoe commented 7 years ago

Hi @joeyparrish and @ismena, I am wondering if you have an estimate for when this work will be ready for a pull request. I am attempting to do some planning, so if you have any information, it would be helpful. My team can also help perform testing when there is something to work with. Thanks.

ismena commented 7 years ago

Hi Doug, When we did the investigation, we found out that we'll have to refactor our streaming model so it works for HLS as well as DASH (the player was initially written with DASH in mind and HLS doesn't fit nicely in our current model). I'm working on that right now and will start looking into HLS as soon as it's done. I plan to start with clear content support first.

My hope is to finish refactoring work this year or early January (it's a pretty big change), so you should start seeing first HLS commits early next year.

I want to be cautious in terms of speaking to the timeline until I've started the work and have full context, but I'll let you know more as soon as I can!

Thanks for the offer to help with the testing, we're always happy to get feedback.

shaharmor commented 7 years ago

@ismena Are you going to use your own HLS provider or hls.js? I highly recommend hls.js 👍

joeyparrish commented 7 years ago

We are going to write a manifest parser plugin for HLS. We do not plan on using hls.js.

bulkinav commented 7 years ago

Hi,

Can you give rough timing of the HLS implementation? One month, two months, half year?

Our service uses the HLS and Widevine Modular, and we very want use a one player for this. Shaka player is good solution, but without HLS is difficult for us.

joeyparrish commented 7 years ago

We will have basic HLS support (clear content, fMP4) first. We expect that to be in the next few weeks.

After that, we will work on MPEG2-TS support, then encrypted content (Widevine & Fairplay). Hopefully this will be done in the next few months.

forbesjo commented 7 years ago

@joeyparrish any thoughts on using https://github.com/videojs/m3u8-parser?

joeyparrish commented 7 years ago

We have always had a policy against third-party JavaScript in the library. It's one of the ways we have been able to keep the library as small as it is.

Also, that module is written in ES6, which we can't use yet because we still need to support IE11. Debugging is only practical for us in uncompiled mode, so compiling ES6 down to ES5 would not meet our needs.

We've already written our own M3U8 parser, and we expect it will be out of review and published on github relatively soon.

ismena commented 7 years ago

Hi everyone!

We're super excited (especially me :) ) to announce that the CL implementing basic HLS parsing has just landed. It has support for audio and video fmp4 streams (no subtitles yet), parsing and integration with our streaming model.

The HLS test asset will soon be available on our demo page after which I'll be starting to look into MPEG2-TS support.

This change should appear on our nightly build page shortly. Feel free to try it out and give us feedback.

Also, please let us know if you are interested in contributing, we'll be happy to discuss it and get to fully supporting HLS faster!

birme commented 7 years ago

I wouldn't mind contributing to the TS remuxing as I have some experience in parsing TS-packets and PES data in Javascript. I assume you intend to repackage AVC+AAC in TS to AVC+AAC in MP4-boxes that the media source can handle?

avelad commented 7 years ago

Hi @ismena, could you add support for m4s? I checked this stream: https://bitdash-a.akamaihd.net/content/MI201109210084_1/m3u8s-fmp4/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.m3u8 and I get "Shaka Error MANIFEST.HLS_COULD_NOT_GUESS_MIME_TYPE (m4s)"

Source of stream: https://bitmovin.com/hls-fragmented-mp4/

joeyparrish commented 7 years ago

@birme, no, we do not plan to transmux. TS will be usable on browsers with native TS support: Safari, IE/Edge, Chromecast.

One could write a response filter that transmuxed TS to MP4 using our new asynchronous filters, but we do not plan on doing so as part of the library.

birme commented 7 years ago

Ok, so no TS support on Chrome/Firefox in the library?

joeyparrish commented 7 years ago

Correct.

ismena commented 7 years ago

@avelad I'll take a look!

ismena commented 7 years ago

@avelad Done, but there is a catch. In order to play this stream shaka.hls.HlsParser.DEFAULT_TIME_OFFSET constant will have to be changed from 10 to 0. 10 seconds seems to be a default start time offset on Apple-encoded content that's why we also set our expectation accordingly.

We're still in the process of finding a better way to detect the start time of the content if none has been specified in the manifest. If a manifest specifies EXT-X-START:TIME-OFFSET=n we will respect this value over the default.

DanielEliraz commented 7 years ago

Can we use the hls feature already? I cloned the master branch and built it, but I had error 4011 when i injected my stream.

joeyparrish commented 7 years ago

@DanielEliraz: The implementation in master is not complete, but error 4011 indicates that the browser doesn't support the content. If it's MPEG2-TS content, Chrome & Firefox do not support that, and Shaka Player does not transmux to MP4.

joeyparrish commented 7 years ago

We have support for MP4 VOD HLS, in the clear and encrypted with Widevine. We have TS working on Edge and Chromecast.

I've created new issues for some of the remaining HLS features:

CEA 708 captions: https://github.com/google/shaka-player/issues/276 Safari FairPlay: https://github.com/google/shaka-player/issues/382 Live streaming: https://github.com/google/shaka-player/issues/740 Key rotation: https://github.com/google/shaka-player/issues/741 Trick mode: https://github.com/google/shaka-player/issues/742 Safari TS: https://github.com/google/shaka-player/issues/743