-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MSE-in-Workers: Consider (eventually) transitioning attached element to error upon termination of MediaSource's worker/what should media element do? #277
Comments
Note, this corresponds to the discussion on the feature issue (#175) beginning at #175 (comment) -- specifically, this issue tracks the first question:
|
Also references w3c#277 for further discussion.
Also references w3c#277 for further discussion.
Specifies expansion of MSE API to usage from DedicatedWorker contexts. This is an MSEv2 feature tracked by issue w3c#175. See also earlier WICG explainer [1]. This is a squashed commit of 23 original commits, notably: * Adds `closing` issue and link to w3c#276. * Adds the `github:` respecConfig key and an issues-summary appendix. * Removes redundant 'Repository' otherLinks config (addition of 'github' to respecConfig has make the manual enumeration in the 'Repository' otherLinks portion of respecConfig redundant.) * Adds subsections for each of the extended HTMLMediaElement's .seekable and .buffered attributes. * Adds more normative detail to the .buffered extension. * Specifies what .seekable and .buffered do when worker has terminated, and references w3c#277 for further discussion. * Describes cross-context track object aliasing. AudioTrack, VideoTrack, TextTrack extensions' sourceBuffer attribute must be null in the Window context's alias of the track if the track is an alias to a worker-created track from MSE-in-Worker. This is to prevent any assumption that cross-context object references are somehow now allowed in MSE or HTMLMediaElement+MSE. * Describes a MessageChannel-based cross-context communication mechanism in a new section, including how MessagePorts on that channel are given to each side (media element, MediaSource) for communicating state needed by algorithms. Updates multiple algorithms and methods to use this mechanism where necessary. Resolves w3c#279. * Specifies how to detect this feature using new `canConstructInDedicatedWorker` attribute without requiring the detection happening in a DedicatedWorker context. * Modernizes to use respec's new variable syntax (`|...|` with types inlined)) for related lines. Wider modernization is an editorial item that is out of scope of this feature. * Modernizes to use internal slots for the new cross-context communication mechanism's channel and ports. Wider modernization is an editorial item out of scope of this feature.o Note, multiple simultaneous changes to track's `selected`, `enabled` or `hidden`/`showing` states could be in-flight from window to worker, and from worker to window. A non-normative note might be good to add here to warn API users of this possibility. See w3c#278. Note, {Audio,Video,Track}{,List} IDL need to be exposed in DedicatedWorker. This might need to be directly in the media element spec. See w3c#280. Note, a reference to an MSE-in-Worker example/demo would be good in the merged PR. Such a demo exists already at [2]. [1] https://github.com/wicg/media-source/blob/mse-in-workers-using-handle/mse-in-workers-using-handle-explainer.md [2] https://wolenetz.github.io/mse-in-workers-demo/mse-in-workers-demo.html
Specifies expansion of MSE API to usage from DedicatedWorker contexts. This is an MSEv2 feature tracked by issue #175. See also earlier WICG explainer [1]. This is a squashed commit of 23 original commits, notably: * Adds `closing` issue and link to #276. * Adds the `github:` respecConfig key and an issues-summary appendix. * Removes redundant 'Repository' otherLinks config (addition of 'github' to respecConfig has make the manual enumeration in the 'Repository' otherLinks portion of respecConfig redundant.) * Adds subsections for each of the extended HTMLMediaElement's .seekable and .buffered attributes. * Adds more normative detail to the .buffered extension. * Specifies what .seekable and .buffered do when worker has terminated, and references #277 for further discussion. * Describes cross-context track object aliasing. AudioTrack, VideoTrack, TextTrack extensions' sourceBuffer attribute must be null in the Window context's alias of the track if the track is an alias to a worker-created track from MSE-in-Worker. This is to prevent any assumption that cross-context object references are somehow now allowed in MSE or HTMLMediaElement+MSE. * Describes a MessageChannel-based cross-context communication mechanism in a new section, including how MessagePorts on that channel are given to each side (media element, MediaSource) for communicating state needed by algorithms. Updates multiple algorithms and methods to use this mechanism where necessary. Resolves #279. * Specifies how to detect this feature using new `canConstructInDedicatedWorker` attribute without requiring the detection happening in a DedicatedWorker context. * Modernizes to use respec's new variable syntax (`|...|` with types inlined)) for related lines. Wider modernization is an editorial item that is out of scope of this feature. * Modernizes to use internal slots for the new cross-context communication mechanism's channel and ports. Wider modernization is an editorial item out of scope of this feature.o Note, multiple simultaneous changes to track's `selected`, `enabled` or `hidden`/`showing` states could be in-flight from window to worker, and from worker to window. A non-normative note might be good to add here to warn API users of this possibility. See #278. Note, {Audio,Video,Track}{,List} IDL need to be exposed in DedicatedWorker. This might need to be directly in the media element spec. See #280. There were some still unresolved cosmetic comments on this PR during later portion of review that I'll follow-up on in a later PR. Note, a reference to an MSE-in-Worker example/demo would be good in the merged PR. Such a demo exists already at [2]. [1] https://github.com/wicg/media-source/blob/mse-in-workers-using-handle/mse-in-workers-using-handle-explainer.md [2] https://wolenetz.github.io/mse-in-workers-demo/mse-in-workers-demo.html
Due to mitigating security issues related to over-optimized cross-context communication in the Chromium experimental implementation, it will soon instead cache a recent value of each of seekable and buffered. Edited: This doesn't fully enable the media element to continue to operate on previously buffered state after the attached MediaSource's execution context has been terminated: the experimental Chromium implementation of this removes the underlying track buffers associated with each SourceBuffer of a MSE-in-Worker whose worker context has destructed while still attached to a not-yet-destructed media element and media element's context is still alive. As such, even though the mitigation caches seekable and buffered, it will still respond with empty ranges if the worker's context has been destroyed. The question remains:
|
Requesting this be discussed at Sept 14 Media WG meeting. |
Minutes from 14 Sep 2021 meeting: https://www.w3.org/2021/09/14-mediawg-minutes.html#t05 |
MSE-in-Workers feature issue is #175
This issue tracks discussing whether or not the
HTMLMediaElement
should do any error transition upon the termination of theDedicatedWorkerGlobalScope
that owns the attachedMediaSource
.The Chromium experimental implementation just leaves the element's readyState, networkState and error attributes as they were prior to the termination, and simply forces the element's
seekable
andbuffered
attributes to each return an empty TimeRange. This is sufficient to prevent unexpected playback of a resource that is no longer available. Note that the termination of the worker is typically caused either by worker.terminate() or DedicatedWorkerGlobalScope.close() from the application side, or as part of teardown of the dedicated workers owned by a Window that is terminating.There may be important edge cases where the app may not know the MediaSource's worker scope is terminated, when it needs to. Hence this issue to discuss and see if an explicit error transition on the element would be useful in this case.
Note that such error transition might not occur until sometime after the termination of the worker has completed, since the termination steps are run in parallel with whatever is running on the element's context, so there will still be a window of time where the app might get empty buffered or seekable TimeRanges and not immediately know why, even if there were some eventual error transition of the element later due to the worker's termination.
The text was updated successfully, but these errors were encountered: