- From: Silvia Pfeiffer <silviapfeiffer1@gmail.com>
- Date: Mon, 20 Jun 2011 12:03:16 +1000
On Mon, Jun 20, 2011 at 11:26 AM, Rodger Combs <rodger.combs at gmail.com> wrote: > 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. Hmm.. I think you want to stay away from mixing content that has come into the browser by file read and content that you want to change and possibly save again. They should be separate tracks. I would suggest that for such cases what you need to do is create a copy of the text track [1] that you want to edit cues on into a mutableTextTrack [2]. You have the remove and add features on such a track already, so should have all the features that you need. [1] http://www.whatwg.org/specs/web-apps/current-work/multipage/the-iframe-element.html#dom-media-addtexttrack [2] http://www.whatwg.org/specs/web-apps/current-work/multipage/the-iframe-element.html#mutabletexttrack Cheers, Silvia.
Received on Sunday, 19 June 2011 19:03:16 UTC