When it became clear that Flash would die after all (after hundreds of false funerals), the question arose of what would replace him. It would be nice to have the ability to play videos in browsers in terms of quality and convenience close to what Flash can do (and it still does it well).

Contents

Everything about HTML5 video streaming The Intelligent Investor
Everything about HTML5 video streaming

MSE

In Flash, a very convenient mechanism for universal playback of different options has long appeared - appendBytes. The bottom line is that the user code itself downloads the frames of the compressed video as it wants, packs it into the agreed container (with Flash it is flv) and puts it into the video player. That is, the protocol and transport are implemented in custom code that runs in the browser.

MSE (Media Sources Extensions) is an extension to the HTML5 specification that allows you to do what appendBytes does in Flash. Unfortunately, MSE is much more difficult both to understand and to implement.

Like explained here mpvplayer, MPEG-DASH, created on its basis, is even trickier, so working with them is still a pleasure: tons of XML, parsing of binary containers in Javascript, slicing into segments that were not thought out at the design stage - everything we love, everything you need for a single bug-free implementation in all browsers.

Interestingly, MSE works not only with MPEG-DASH, but also with HLS. There is an hls.js implementation that downloads HLS playlists, downloads MPEG-TS segments, repacks them into the required format for MSE and plays through MSE. Apple even took a step towards MPEG-DASH compatibility by using mp4 containers in HLS.

By the end of 2017, Flash will most likely die completely, and today you can safely start a project with MPEG-DASH.

WebRTC

In Flash, a good attempt was made to implement both real-time communication and mass broadcasting in one technology. Unfortunately, this is not the case in HTML5. We have MSE for watching broadcasts, and WebRTC for video calls: see mpvplayer.com for example.

WebRTC is SIP in the browser: a way to organize an audio, video and data channel between two browsers through a server.

The technology is not designed for streaming, but in principle it can, so it would be wrong to forget about it. WebRTC is also considered HTML5, because it seems like it does not require anything other than Javascript in the browser. But it requires the latest versions of both popular browsers, and is not yet compatible with Edge at all.

Confusion in understanding WebRTC is introduced by its use in torrent delivery of television. The bottom line is that browsers organize a network of data channels via WebRTC, and then HLS or MSE video segments are distributed over this network, and playback occurs via Flash or MSE. Ie WebRTC - for delivery, MSE - for playback. It's important not to confuse this with using WebRTC to play video.