Enable Media Source Extensions (MSE) API usage from DedicatedWorker contexts to enable improved performance of buffering media for playback by an HTMLMediaElement on the main Window context. By creating a MediaSource object on a DedicatedWorker context, an application may then create an ObjectURL for it and postMessage that URL to the main thread for use in attaching to an HTMLMediaElement. The context that created the MediaSource object may then use it to buffer media.
Main interoperability risk is that other browsers may not implement it. Compatibility risk is mitigated by unchanged same-thread MSE API support and proactive feature-detectability of MSE-in-Workers with a new canConstructInDedicatedWorker attribute on the MediaSource interface.
DedicatedWorker, WorkerGlobalScope and postMessage/onmessage availability is integral to using this feature.
The primary risk is the potential difficulty in refactoring existing MSE web applications to (conditionally, depending on browser support) perform buffering in a different execution context from the Window context that hosts the DOM and the media element. The benefit of potentially improved buffering performance by offloading the MSE API usage to a worker context provides motivation to overcome this challenge.
Unpredictability of racing context destruction of either the main thread hosting the media element (and owning the underlying MSE media demuxer and player) or the dedicated worker thread hosting the interface to the MSE demuxer when using MSE from a worker context motivated careful design of a refcounted, outside-of-Oilpan, attachment abstraction to ensure safety of operations using locks and having a lifetime that exceeds those execution contexts. Preventing use-after-free and similar was a primary complexity of implementation and a focus area of added tests.
* Obtain developer feedback on API ergonomics and implementation stability. * Increase confidence in benefits of feature (exposing and enabling MSE usage from DedicatedWorker contexts) to support its standardization.
There are two reasons extension is necessary: 1) A breaking error discovered in the middle of the trial (see https://crbug.com/1268614) caused participation to drop before the 2021 holiday period. While the fix landed by early 2022 and at least one participant has reported excellent improvement in metrics in their experiment since then, further stabilization is desired. 2) An API change for this feature (using srcObject for MSE-in-Workers attachments instead of baking in objectURL attachment further) was agreed with the media workgroup last September [1] following the previous objectURL-based attachment design getting more recent feedback [2], and I'm working on getting that into both the feature spec and Chromium's experimental implementation currently for rapid experimentation during the extended trial. [1] https://www.w3.org/2021/09/14-mediawg-minutes.html [2] https://github.com/mozilla/standards-positions/issues/547
Feature consists of exposing existing interfaces also on a DedicatedWorker, and addition of a WebIDL method for proactively detecting support for this feature, and are covered by basic tooling.
MSE and DedicatedWorker already exist on all six Blink platforms. This feature lets MSE work from DedicatedWorker contexts.
OriginTrial desktop last | 99 |
OriginTrial desktop first | 95 |
OriginTrial android last | 99 |
OriginTrial android first | 95 |