videojs / video.js

Video.js - open source HTML5 video player
https://videojs.com
Other
37.95k stars 7.43k forks source link

RFE: Support HLS streaming #293

Closed elad661 closed 10 years ago

elad661 commented 11 years ago

HLS Streaming is a protocol invented by Apple that is already implemented in all mobile browsers and is an open spec. Altough this format is dead simple and is widespread in the mobile world, there is no desktop browser which properly supports it as a video source in the <video> tag apart from Safari.

The format is relatively simple, and since it is just a basic text file which refers to MPEG4 contained in MPEG-TS, the parsing of this format could be easily done in JavaScript (as part of the VideoJS library) and the TS files can be loaded with the native <video> tag under most browsers (and will probably play well with the flash fallback as well, seeing how Flowplayer already supports it in its flash version and jwplayer already supports it in a paid version).

At the time of filing this issue, there is no JS library out there that can do this. Implementing this in Javascript will allow websites to use VideoJS and HTML5 video for live content, which is kinda awesome.

jhurliman commented 11 years ago

My understanding is that this has been tried before, but there are pauses every time a new MPEG-TS segment starts playing.

elad661 commented 11 years ago

Even with double buffering of the video stream? (ie. load the next TS in a separate video element, then switch between elements on the fly)

jhurliman commented 11 years ago

That was my understanding, but I haven't tried this myself so I can't say with certainty.

Thinkscape commented 11 years ago

@jhurliman Could you point me to where you found out about that?

fthiery commented 11 years ago

Indeed, adding support for HLS within flash (e.g. based on https://github.com/theturtle32/OSMF-AppleHLS, http://code.google.com/p/apple-http-osmf/) would be an incredible feature, because there are currently no free alternatives (from what i know jw player 6 does it, as a few costly OSMF plugins like http://osmfhls.kutu.ru/ or http://onlinelib.de/). But i guess the task is big, because you need some multi-threaded "triple chunk buffering" (i.e. fetching segment 2, decoding segment 1 and displaying segment 0), which may explain why everyone is charging so much for it. But from a small CMS video vendor standpoint, it would be huge in terms of simplicity and deployment capabilities (come on, you would actually be able to SEEK even when using IIS as webserver -- sounds incredible, doesn't it ?) without breaking apple compatibility. Anyway, i hope it'll actually be possible someday.

fthiery commented 11 years ago

@elad661 you have to do this inside Flash, because HTML5

Miserlou commented 11 years ago

Just out of curiosity - is there any serious discussion being given to this enhancement - is this actually on the VideoJS roadmap yet?

I'd absolutely love to see support for HTML5 support for HLS and MPEG-DASH - pretty astounding that FF/Chrome don't support this natively yet, but seems like pure HTML5+JS should totally be feasible.

Not sure about Chrome, but Firefox have abandoned their plans to integrate native HLS support in favor of a system which uses the Media Source Extensions API to support MPEG-DASH https://bugzilla.mozilla.org/show_bug.cgi?id=778617 https://bugzilla.mozilla.org/show_bug.cgi?id=734546 https://developer.mozilla.org/en-US/docs/DASH_Adaptive_Streaming_for_HTML_5_Video

Which means that HLS will have to be taken care of in VideoJS or in VideoJS's flash component.. any ideas?

fthiery commented 11 years ago

Pure HTML5 + JS would give you the same fragment "stiching" performance as https://mixbit.com/ ; to test it, make an HLS stream, push the TS fragments into mixbit and listen to the result. I doubt it'll be interesting. Don't underestimate the work of coding a software mpegts demuxer and a multi-threaded video player... in ActionScript...

IMO, this thing may come natively into browsers (DASH, probably) or only in Flash.

Today, the easiest way to go would be to use JW Player 6 as Flash fallback component of VideoJS.

Miserlou commented 11 years ago

DASH support is "coming" to browsers, though I have emailed the DASH devs at Mozilla for a status report and haven't yet received a reply.

We have discovered that the best way to play HLS right now with open source tools is with Adobe's Open Source Media Framework in combination with this open source plugin by @denivip https://github.com/denivip/osmf-hls-plugin

I don't know anything about the flash side of VideoJS - does it use OSMF? Does VideoJS accept additions which only enhance the flash component?

mmcc commented 10 years ago

There's work being done to support HLS in the Flash fallback. It's still very much in alpha, but it is available if you'd like to start playing with it: #748

Going to go ahead and close this ticket since this is in the works.