[whatwg] TextTrackCueList methods for adding/removing/editing cues

Rodger Combs rodger.combs at gmail.com
Sun Jun 19 18:26:00 PDT 2011

There are a few possible cases when JavaScript may need to add, remove, read, or modify a cue from a <track>:
1. A web-based caption editor
2. Parsing captions from an external non-WebVTT file (retrieved with XHR, EventSource [for live videos], WebSocket, etc.)
3. Live translating of captions using an external translation API
4. Probably more that I'm not thinking of
Adding a set of methods to the TextTrackCueList for cue modification could be useful. Here's an example interface:

TextTrackCue addCue(in double startTime, in double endTime, in DOMString text, in optional DOMString[] flags);
void removeCue(in TextTrackCue);
void removeCueById(in DOMString id);

Also, I recommend that in TextTrackCue, startTime, endTime, and pauseOnExit are made non-readonly, and that "attribute DOMString text;" is added to the interface.

So, thoughts?

More information about the whatwg mailing list