This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 22601 - Add API for RemoveTextTrack()
Summary: Add API for RemoveTextTrack()
Status: RESOLVED WONTFIX
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: All All
: P2 enhancement
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL:
Whiteboard:
Keywords:
Depends on: 22597
Blocks:
  Show dependency treegraph
 
Reported: 2013-07-09 02:52 UTC by Silvia Pfeiffer
Modified: 2013-07-26 23:29 UTC (History)
12 users (show)

See Also:


Attachments

Description Silvia Pfeiffer 2013-07-09 02:52:58 UTC
+++ This bug was initially created as a clone of Bug #22597 +++

Right now there is an AddTextTrack() function on the MediaElement, but there is no RemoveTextTrack() function.

TextTrackList has an "onremovetrack" event, but as far as I can see there is no way currently for the user to remove a TextTrack.
Comment 1 Ian 'Hixie' Hickson 2013-07-09 23:00:04 UTC
Is there a compelling use case?

What API would you want for this?

   // track = video.addTextTrack(...);
   video.removeTextTrack(track); ?
   video.textTracks.remove(track); ?
   video.textTracks.remove(index); ?
   video.textTracks[index].remove(); ? // i.e. track.remove()

What should happen if the text track was not created by addTextTrack()? Should addTextTrack return a different class, like CustomTextTrack, which has a remove() method, thus making it impossible to call on other tracks? Or just throw InvalidStateError in other cases?
Comment 2 Rick Eyre 2013-07-09 23:19:55 UTC
(In reply to comment #1)
> Is there a compelling use case?

I didn't have a particular use case in mind when requesting this.

The main thing I was thinking of was why we have an "onremovetrack" event when there isn't a way to remove tracks. Is there a reason to keep "onremovetrack" if there is no RemoveTextTrack() functionality?

My thinking was that either RemoveTextTrack() should be added or "onremovetrack" should be removed.

> What API would you want for this?

video.removeTextTrack(track) is along the lines of what I was thinking.

> What should happen if the text track was not created by addTextTrack()?
> Should addTextTrack return a different class, like CustomTextTrack, which
> has a remove() method, thus making it impossible to call on other tracks? Or
> just throw InvalidStateError in other cases?

Throwing an error would be simpler IMO, but it would be weird being able to remove some, but not all of the Tracks in the list. Maybe we could have two TextTrackLists on the MediaElement. One which has Tracks that cannot be touched by the user i.e. ones that were sourced from the media resource or track elements. The other list could be of Tracks that were added manually with addTextTrack() and this list would be able to have tracks removed.
Comment 3 Ian 'Hixie' Hickson 2013-07-10 00:22:29 UTC
The 'removetrack' event can fire if you remove the <track> element of an external track. We don't currently ever remove an in-band text track, because it might have been manipulated or might be about to be manipulated. (If we made in-band text tracks readonly, we could probably get away with cleaning them up when they fall into the time before the earliest possible position and are known to be over and done with, but this isn't something that's come up yet.) We also don't currently have a way to remove tracks added using addTextTrack(), as this bug notes.

If there's no compelling use case for removing a text track added with addTextTrack, I'm happier to not add it, at least not in the near future. There's a lot of more critical stuff to deal with first, and every feature has a cost.

   http://wiki.whatwg.org/wiki/FAQ#Where.27s_the_harm_in_adding.E2.80.94
Comment 4 Rick Eyre 2013-07-10 00:53:21 UTC
(In reply to comment #3)
> The 'removetrack' event can fire if you remove the <track> element of an
> external track. 

Ah yes, I see.

> If there's no compelling use case for removing a text track added with
> addTextTrack, I'm happier to not add it, at least not in the near future.
> There's a lot of more critical stuff to deal with first, and every feature
> has a cost.
> 
>    http://wiki.whatwg.org/wiki/FAQ#Where.27s_the_harm_in_adding.E2.80.94

That's fine with me. Thanks for the explanation.
Comment 5 Ian 'Hixie' Hickson 2013-07-26 23:29:18 UTC
Ok, cool. I'm marking this WONTFIX for now; if a use case does come up, please don't hesitate to reopen this bug.