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 17235 - <track> missed cues will include all past cues from a newly enabled track
Summary: <track> missed cues will include all past cues from a newly enabled track
Status: RESOLVED FIXED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-29 15:35 UTC by contributor
Modified: 2012-09-11 23:23 UTC (History)
3 users (show)

See Also:


Attachments

Description contributor 2012-05-29 15:35:57 UTC
Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html
Multipage: http://www.whatwg.org/C#media-playback
Complete: http://www.whatwg.org/c#media-playback

Comment:
<track> missed cues will include all past cues from a newly enabled track

Posted from: 2001:4c28:a032:32:9589:8db1:7691:37b7 by philipj@opera.com
User agent: Opera/9.80 (X11; Linux x86_64; U; Edition Next; en) Presto/2.10.289 Version/12.00
Comment 1 Philip Jägenstedt 2012-05-29 15:42:56 UTC
<quote>
1. Let current cues be a list of cues, initialized to contain all the cues of all the hidden, showing, or showing by default text tracks of the media element (not the disabled ones) whose start times are less than or equal to the current playback position and whose end times are greater than the current playback position.

2. Let other cues be a list of cues, initialized to contain all the cues of hidden, showing, and showing by default text tracks of the media element that are not present in current cues.

4. If the current playback position has, since the last time this algorithm was run, only changed through its usual monotonic increase during normal playback, then let missed cues be the list of cues in other cues whose start times are greater than or equal to last time and whose end times are less than or equal to the current playback position. Otherwise, let missed cues be an empty list.
</quote>

By this definition, switching tracks while playback is ongoing will cause all cues in the new track that have already ended to be treated as missed, which will cause enter/exit events to be fired. This seems fairly broken and is not what we want to implement.

A quickfix that matches our intentions is to rewrite step 2 to only add cues from tracks that were in the track list the last time the algorithm was run to "other cues".
Comment 2 Philip Jägenstedt 2012-05-29 15:49:14 UTC
It looks like the spec might also treat cues recently added by scripts as missed, which is similarly broken. We "synchronize" a track every time a new cue is added by script to avoid treating such cues as missed, but are not quite sure how to express that in the spec...
Comment 3 Philip Jägenstedt 2012-06-01 16:09:40 UTC
We've now fixed our implementation to never consider tracks inserted between invocations of the "When the current playback position of a media element changes" algorithm as missed. All cues are initially placed on a pending list, and in the next invocation of the algorithm they can never be considered missed. The pending list is then cleared. We think this is the behavior that makes the most sense, but of course don't mind how it's expressed in the spec.
Comment 4 Philip Jägenstedt 2012-06-01 16:17:10 UTC
(In reply to comment #3)
> We've now fixed our implementation to never consider tracks inserted between

Typo, I meant cues inserted between invocations. (This is a separate issue from inserted tracks, sorry for mixing both in the same bug.)
Comment 5 contributor 2012-07-18 17:41:12 UTC
This bug was cloned to create bug 18208 as part of operation convergence.
Comment 6 Ian 'Hixie' Hickson 2012-09-11 23:22:20 UTC
Seems like a good plan. Let me know if my implementation of it works for you.
Comment 7 contributor 2012-09-11 23:23:19 UTC
Checked in as WHATWG revision r7329.
Check-in comment: Avoid firing enter/exit events on cues that have just been introduced, e.g. when a track is enabled, since that's just crazy.
http://html5.org/tools/web-apps-tracker?from=7328&to=7329