Skip to content

v3.11.0

Compare
Choose a tag to compare
@peaBerberian peaBerberian released this 07 Mar 19:30

Release v3.11.0 (2019-03-07)

Overview

This release mainly add two new features:

  • languages/api: add the notion of preferred audio and text tracks, much more flexible than the previous default track configuration.
  • allow playing a mix of unencrypted and crypted contents on Chrome. We're now able to do that at least in Chrome, Firefox and Edge (we did not test that usage on Safari yet).

It also adds multiple bug fixes and other little improvements, the most important ones being:

  • minimumUpdatePeriod DASH attributes were accidentally ignored, we manage that again
  • For smooth contents, you have now much less risk to encounter 412 HTTP requests
  • For TypeScript users, the addEventListener and removeEventListener are now completely type-checked. Each event is linked to its corresponding payload.
  • Each warning and error has now a readable string as their message attributes.

Language preferences

To permit much more control over language preferences, we added 4 new methods (setPreferredAudioTracks, getPreferredAudioTracks, setPreferredTextTracks and getPreferredTextTracks) and 2 new player options (preferredAudioTracks and preferredTextTracks).
Those take or return an array of audio or text track preferences (from the more preferred to the least preferred) and can be changed at any time: when a content plays as well as when no content is playing.

Those two specificities are particularly interesting for multi-period DASH contents, where you can have much more control over languages we automatically choose for subsequent periods.

Those new methods and properties and the corresponding behaviors are all defined in our documentation. Here are quick links for each of them:

Consequently, the defaultAudioTrack and defaultTextTrack loadVideo options are now deprecated. To help you switch from them to the new APIs, we added a chapter in our documentation about deprecated APIs.

Mix of crypted and unencrypted contents on Chrome

We previously were unable to switch from an unencrypted segment to an encrypted segment in Chrome. Those "mixed contents" would buffer indefinitely when doing that switch.

This was because our previous logic tried to perform DRM negociations lazily (only when DRM is needed):
When first playing an unencrypted content we did dot initialize encryption-related logic, this was done just after the first encrypted segments was downloaded.

This strategy sound smart on paper but did not work with how Chrome implemented those APIs. We thus now begin to perform that logic immediately when starting the content (usually at the same time at which we fetch the manifest file) which is what most browsers expect. This behavior works at least with Chrome, Firefox and Edge. Safari was not tested, please let us know if you have related problems on it.

Note: This initialization only happens if the keySystems loadVideo option contains at least one key system, to avoid doing that unnecessary logic for contents we know to be unencrypted.

Less 412 HTTP errors for segment requests with Smooth streaming contents

After our last versions were deployed on multiple Canal+ applications, we saw a huge bump in our request error metrics: a lot of our segment requests were failing with a 412 HTTP error for HSS (Smooth Streaming) contents.

This usually means that we are requesting a segment before it was actually generated on the server-side.
This can be provoked by inferring future segments from the metadata of previous ones, and then requesting them too soon.

We now avoid those errors by doing a better estimation on which segments should be available on the server. This is done by considering the last manifest we downloaded and calculating the amount of elapsed time since.

As an example, we won't download a segment ending at a timestamp of 50 seconds if a manifest downloaded 10 seconds ago ended with a segment at a timestamp of 30 seconds (the max on the server now would be 30+10=40s).

addEventListener and removeEventListener type safety

We worked on improving type safety on the player in this release. If you're using TypeScript, you could now have type errors with addEventListener and removeEventListener depending on how they were used: the payload type is now correlated with the event string.

This brings several advantages:

  • your calls will now be type-checked. You should thus detect more errors if you are using those methods wrongly
  • depending on your editor and plugins, you could now have a nice contextual auto-completion when writing event listeners

Five new player events

Speaking of events, we added five player events we thought were missing. Those are (linked to their corresponding documentation):

Changelog

Features

  • languages/api: add preferredAudioTracks and preferredTextTracks player options
  • languages/api: add setPreferredAudioTracks, getPreferredAudioTracks, setPreferredTextTracks and getPreferredTextTracks methods
  • languages/api: add availableAudioTracksChange, availableTextTracksChange and availableVideoTracksChange events
  • abr/api: add availableAudioBitratesChange and availableVideoBitratesChange events
  • eme: allow playback of mixed encrypted and unencrypted contents on Chrome
  • types: export the new IAudioTrackPreference and ITextTrackPreference types

Deprecated

  • languages/api: deprecate the defaultAudioTrack loadVideo option in favor of the preferredAudioTracks player option.
  • languages/api: deprecate the defaultTextTrack loadVideo option in favor of the preferredTextTracks player option.

Bug fixes

  • dash: fix minimumUpdatePeriod management for DASH contents
  • smooth: better prevent 412 HTTP errors for smooth streaming contents
  • subtitles: ensure subtitles are not visible in Firefox when disabling them in the "native" textTrack mode.
  • errors: avoid sending multiple MEDIA_TIME_BEFORE_MANIFEST or MEDIA_TIME_AFTER_MANIFEST warnings instead of just one
  • api: fix (deprecated) option hideNativeSubtitles

Other improvements

  • errors: set a readable error message for every error and warnings thrown
  • tools/mediaCapabilitiesProber: set logs about unimportant missing APIs as debug-level instead of warn-level
  • types: provide type safety to addEventListener and removeEventListener