Skip to content
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

Add video.removeTextTrack() method #2881

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -32028,6 +32028,7 @@ interface <dfn>HTMLMediaElement</dfn> : <span>HTMLElement</span> {
[SameObject] readonly attribute <span>VideoTrackList</span> <span data-x="dom-media-videoTracks">videoTracks</span>;
[SameObject] readonly attribute <span>TextTrackList</span> <span data-x="dom-media-textTracks">textTracks</span>;
<span>TextTrack</span> <span data-x="dom-media-addTextTrack">addTextTrack</span>(<span>TextTrackKind</span> kind, optional DOMString label = "", optional DOMString language = "");
void <span data-x="dom-media-removeTextTrack">removeTextTrack</span>(<span>TextTrack</span> textTrack);
};</pre>

<p>The <dfn>media element attributes</dfn>, <code data-x="attr-media-src">src</code>, <code
Expand Down Expand Up @@ -36716,6 +36717,13 @@ interface <dfn>TextTrack</dfn> : <span>EventTarget</span> {

</dd>

<dt><var>media</var> . <code subdfn data-x="dom-media-removeTextTrack">removeTextTrack</code>( <var>textTrack</var> )</dt>
<dd>

<p>Removes a TODO.</p>

</dd>

<dt><var>textTrack</var> . <code subdfn data-x="dom-TextTrack-kind">kind</code></dt>
<dd>

Expand Down Expand Up @@ -36864,6 +36872,41 @@ interface <dfn>TextTrack</dfn> : <span>EventTarget</span> {

<hr>

<p>The <dfn><code
data-x="dom-media-removeTextTrack">removeTextTrack(<var>textTrack</var>)</code></dfn> method of
<span data-x="media element">media elements</span>, when invoked, must run the following
steps:</p>

<ol>
<li><p>If <var>textTrack</var> is not in the <span>media element</span>'s <span>list of text
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternate design: return without throwing. Not sure which is better.

tracks</span>, then throw a <span>"<code>NotFoundError</code>"</span> <code>DOMException</code>
and abort these steps.</p></li>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: no need for "and abort these steps" these days. See #2878


<li>
<p>If <var>textTrack</var> has a corresponding <code>track</code> element, then <span
data-x="concept-node-remove">remove</span> that <code>track</code> element and abort these
steps.</p>

<p class=note>This will cause <var>textTrack</var> to be removed from the <span>media
element</span>'s <span>list of text tracks</span> and a <code
data-x="event-media-removetrack">removetrack</code> event to be fired.</p>
</li>

<li><p>If <var>textTrack</var> is a <span>media-resource-specific text track</span>, then
TODO.</p></li>

<li><p>Remove <var>textTrack</var> from the <span>media element</span>'s <span>list of text
tracks</span>.</p></li>

<li><p><span>Queue a task</span> to <span data-x="concept-event-fire">fire an event</span> named
<code data-x="event-media-removetrack">removetrack</code> at the <span>media element</span>'s
<code data-x="dom-media-textTracks">textTracks</code> attribute's <code>TextTrackList</code>
object, using <code>TrackEvent</code>, with the <code data-x="dom-TrackEvent-track">track</code>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the textTracks attribute is a TextTrackList object, this doesn't seem right. Maybe just omit 's TextTrackList object.

attribute initialized to <var>textTrack</var>.</p></li>
</ol>

<hr>

<p>The <dfn><code data-x="dom-TextTrack-kind">kind</code></dfn> attribute must return the
<span>text track kind</span> of the <span>text track</span> that the <code>TextTrack</code> object
represents.</p>
Expand Down