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 18480 - Negative timestamps for TextTrackCues
Summary: Negative timestamps for TextTrackCues
Status: RESOLVED FIXED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-02 23:52 UTC by Anna Cavender
Modified: 2013-04-15 23:07 UTC (History)
4 users (show)

See Also:


Attachments

Description Anna Cavender 2012-08-02 23:52:52 UTC
As far as I can tell, the spec does not specify behavior for negative values of timestamps in TextTrackCues.
http://www.whatwg.org/specs/web-apps/current-work/#texttrackcue

Negative time values are not allowed in WebVTT (a '-' would constitute a malformed timestamp and the entire cue would be dropped on the floor).  However, negative time values could be specified via:

(a) var cue = TextTrackCue('cue1', -3, 3, 'This cue starts before the video itself!')");

or

(b) cue.startTime = -1000;

Should this be allowed?

I can think of a few options:

(1) Throw an error and drop the cue.
    - In the case of (a), should the constructor return null? an empty cue?
    - In the case of (b), should the cue maintain it's original startTime?  Should it be removed from the track it is associated with?

(2) Set the time value to 0 (or to the startTime of the media) rather than allowing the negative value.
    - Should we also throw an error in this case to notify authors that the value was not accepted?

(3) Allow negative timestamps to exist and just never render that cue (or render it if the time span does in fact overlap the video, e.g. -5 --> 5 would be rendered from 0 to 5).
    - I suppose authors could use negative timestamps to force cue ordering for cues that all start at 0.
    - Should the enter, exit, and cuechange events fire at 0 or not at all?

What are your thoughts?
Comment 1 Ian 'Hixie' Hickson 2012-10-08 22:31:37 UTC
As specced, I believe it's 3, and that it's all defined, but it may be that we should change, certainly.

foolip, zcorpan: any opinions?
Comment 2 Simon Pieters 2012-10-09 06:53:23 UTC
I don't mind allowing negative times. It might happen accidentally (e.g. trying to sync a text track with a video by changing the times with a certain offset) but seems harmless when it happens.
Comment 3 Philip Jägenstedt 2012-10-09 07:26:43 UTC
I agree, negative times seems harmless. As far as I can tell, the spec already requires that the enter event be fired for such cues:

"For each text track cue in current cues that does not have its text track cue active flag set, prepare an event named enter for the TextTrackCue object with the text track cue start time."
Comment 4 Ian 'Hixie' Hickson 2013-03-15 21:57:45 UTC
Ok well then I'll add a note somewhere to mention that #3 is what's required, just so that nobody thinks it's unintentional.
Comment 5 contributor 2013-04-15 23:07:48 UTC
Checked in as WHATWG revision r7841.
Check-in comment: Note regarding negative time cues.
http://html5.org/tools/web-apps-tracker?from=7840&to=7841