Skip to content

Commit 099830e

Browse files
authored
Refine srcObject's MediaSourceHandle behavior (#306)
* Refine srcObject's MediaSourceHandle behavior Overall intent for a `MediaSourceHandle` is that it should be [Transferable], and be restricted to "at most one" successful attachment to the underlying `MediaSource` by a handle. Further, if a `Window` `MediaSource` was previously attached using a legacy MSE object URL, subsequent attempts to use that `MediaSource` instance's `MediaSourceHandle` for attachment must also fail. * Changes `MediaSource.getHandle()` to be a `[SameObject] readonly attribute` named `handle`. * Adds HTMLMediaElement.srcObject extension subsection. * Updates MediaSourceHandle transfer and related attachment text to more clearly indicate that transferring a handle prevents re-transfer of that instance due to the [[Detached]] internal slot's logic, and that transfer is also synchronously prevented if the handle instance's [[has ever been assigned as srcobject]] internal slot is true. Also adds multiple notes to describe intent and to clarify. * Updates the "attaching to a media element" text to indicate that a `MediaSourceHandle` can be attached successfully to at most one media element ever. Note that legacy MSE object URL attachments similarly already achieve the same intent in existing implementations. This change includes a clarification for MSE object URL attachments, since it was never the intent even for main-thread `MediaSource` attachments for them to be successfully attached to more than one `HTMLMediaElement` at a time. The switch to more clear `srcObject` usage for worker MSE attachment affords the spec an opportunity to be more clear about this intent. This refinement originates from discussion on the previous PR with @karlt (#305) and from lengthy discussion on this change itself at #306. This work is associated with the MSE-in-Worker spec issue: #175 Multiple further changes made in response to review comments on this PR are also included: * MSE-in-Workers: Update attaching to a media element language Editorial only, based on PR comment: #306 (comment) * MSE-in-Workers: Further update the attaching to a media element text Mostly editorial, in response to PR review comments. Non-editorial change: * Adds condition on [[Detached]] internal slot of a MediaSourceHandle, preventing successful attachment start if the handle instance is already transferred (detached). Editorial changes: * Replaces "been used beyond this point" text with a new MediaSource internal slot [[has ever been attached]]. Adds that slots definition and initialization in the MediaSource section, and also updates that internal slot to be true in the attaching steps. * Removes redundant-with-readyState-closed clause "being using beyond this point". * MSE-in-Workers: Minor editorial update to extended resource fetch algorithm text Editorial change in response to PR comment: #306 (comment) Changes "these clarifications" to "these requirements" * MSE-in-Workers: Another minor editorial update to extended resource fetch algorithm text Editorial change in response to PR comment: #306 (comment) Changes "do not apply" to "shall not apply" * MSE-in-Workers: Minor editorial clarification to meaning of Detached In response to PR comment: #306 (comment) * MSE-in-Workers: editorial, add reference to definition of "agent cluster" Editorial change in response to PR comment: #306 (comment) Adds normative reference to ECMAScript's definition of agent cluster, and adds an informative reference to related concepts in HTML where agent and agent cluster concepts from ECMAScript are integrated into HTML for Web APIs. * MSE-in-Workers: Remove justification from srcObject setter extension note In response to PR comment: #306 (comment) * MSE-in-Workers: Remove a couple redundant transfer steps Editorial, in response to PR comments: #306 (comment) #306 (comment) StructuredSerializeWithTransfer already moderates transfer success of Transferable objects like MediaSourceHandle with the object's [[Detached]] internal slot, so explicit extra steps to do this just for MediaSourceHandle are unnecessary and potentially confusing. Removed.
1 parent eb0f004 commit 099830e

File tree

1 file changed

+255
-107
lines changed

1 file changed

+255
-107
lines changed

0 commit comments

Comments
 (0)