Add HTMLMediaElement.removeTextTrack() method - #12735
Conversation
Adds a removeTextTrack(track) method that undoes addTextTrack(), mirroring its algorithm and phrasing. Only text tracks added via addTextTrack() can be removed this way; removing a track corresponding to a track element or an in-band track throws a NotFoundError.
|
@dalecurtis WDYT? |
|
Mozilla likes this, thanks for proposing it. Now that real-time Speech Recognition (using e.g. the Web Speech API) is a reality, this can help to implement neat auto-captioning systems, potentially with translations in different languages, since this is also a reality, while being able to clean up when e.g. the audio track / language of the subtitles is changed by the user or website. https://bugzilla.mozilla.org/enter_bug.cgi?component=Audio%2FVideo%3A%20Playback&product=Core will let you file a bug on our BMO instance in the right component when it's time to file. |
|
Generally sgtm. Do we need to restrict removal to just added tracks? Sometimes tracking state like that can be unnecessarily complicated and a surprising edge case to a user. |
That's a good point- I can see it being confusing for the user if it is restricted to added tracks. |
If by "user" you mean the page author, they should know if a track has been added with JS or not so they will know if it can be removed. Allowing removal of tracks not created with
|
| <p>The <dfn method for="HTMLMediaElement"><code | ||
| data-x="dom-media-removeTextTrack">removeTextTrack(<var>track</var>)</code></dfn> method of | ||
| <span data-x="media element">media elements</span>, when invoked, must run the following | ||
| steps:</p> |
There was a problem hiding this comment.
We should use the modern way of phrasing this:
"The X method steps are:"
|
|
||
| <li><p><var>track</var> was not added to <span>this</span>'s <span>list of text | ||
| tracks</span> by a call to <span>this</span>'s <code | ||
| data-x="dom-media-addTextTrack">addTextTrack()</code> method,</p></li> |
There was a problem hiding this comment.
Ideally we'd handle this as state on track so we don't need COMEFROM wording.
| </li> | ||
|
|
||
| <li> | ||
| <p>Remove <var>track</var> from <span>this</span>'s <span>list of text tracks</span>.</p> |
There was a problem hiding this comment.
If the removal is synchronous, is there a reason to fire the event from a task?
Adds a removeTextTrack(track) method that undoes addTextTrack(), mirroring its algorithm and phrasing. Only text tracks added via addTextTrack() can be removed this way; removing a track corresponding to a track element or an in-band track throws a NotFoundError.
(See WHATWG Working Mode: Changes for more details.)
/acknowledgements.html ( diff )
/media.html ( diff )