- From: Rob Smith via GitHub <sysbot+gh@w3.org>
- Date: Fri, 31 May 2019 10:23:24 +0000
- To: public-web-and-tv@w3.org
@mavgit Thanks for the clear use cases [above](https://github.com/w3c/me-media-timed-events/issues/39#issuecomment-494596204), which have made me realise that these can already be supported by the API, as follows:
a. The [`TextTrackCueList`](https://html.spec.whatwg.org/multipage/media.html#texttrackcuelist) is an existing interface, so cues can be read from the [`TextTrack`](https://html.spec.whatwg.org/multipage/media.html#texttrack) object.
b. The [`TextTrackCue`](https://html.spec.whatwg.org/multipage/media.html#texttrackcue) object exposes the `endTime` attribute which [can be set](https://html.spec.whatwg.org/multipage/media.html#dom-texttrackcue-endtime).
c. Hence, cues can be updated by removing, updating and then adding them back to the list. For example:
```javascript
function updateCueEnd(textTrack, cueIndex, endTime) {
// read cue to update
var cue = textTrack.cues[cueIndex];
// remove cue
textTrack.removeCue(cue);
// update end time
cue.endTime = endTime;
// add updated cue
textTrack.addCue(cue);
}
```
[Best practices for metadata text tracks](https://html.spec.whatwg.org/multipage/media.html#best-practices-for-metadata-text-tracks) describes a recommendation for handling scoring for a sports event and considers the live streaming case, which offers another good use case for updating media timed events. At the start of the match the score is '0-0', which could change to either '1-0' or '0-1' at an unknown time in the future.
--
GitHub Notification of comment by rjksmith
Please view or discuss this issue at https://github.com/w3c/me-media-timed-events/issues/39#issuecomment-497659814 using your GitHub account
Received on Friday, 31 May 2019 10:23:25 UTC