We'll cross the (media) streams, Ray

Published on Updated on

Today, when using Media Source Extensions (MSE) in Chrome, it's not possible to switch between encrypted and clear streams. This is actually not prohibited by the MSE spec. Rather, this limitation is mostly in how the media pipeline is setup to support Encrypted Media Extensions (EME).

MSE requires that media streams start with an initialization segment which includes information like codec initialization data, and encryption information. Typically, the initialization segment is at the beginning of a media file. Consequently, when media are attached to a media element via download or MSE, they "just work".

The problem comes when you try to change media characteristics in mid stream. Changing media characteristics requires passing a new initialization segment. For most characteristics, this works. Playback continues. The exception is the encryption settings. The encryption settings from the first initialization segment only signal whether the stream segments may be encrypted, meaning clear media segments can be inserted in the stream. Corollary to this is that an unencrypted stream with even a single encrypted segment requires that encryption information be included in the initialization segment. Because of this, ad insertion requires workarounds that don't apply to other platforms.

Starting in Chrome 58, all this changes. You can now switch between encrypted and unencrypted in the same stream. This improves compatibility by matching behavior that already exists in Firefox and Edge.

This has a few caveats. First, if you anticipate any encrypted segments in your media streams, you must set the MediaKeys up front. As before, you cannot mix HTTP and HTTPS in the same source.

Updated on Improve article

Back

Media updates in Chrome 58

Next

Deprecations and Removals in Chrome 58

This site uses cookies to deliver and enhance the quality of its services and to analyze traffic. If you agree, cookies are also used to serve advertising and to personalize the content and advertisements that you see. Learn more about our use of cookies.