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 28973 - <track> elements added with their text track already showing do not run the "time marches on" steps
Summary: <track> elements added with their text track already showing do not run the "...
Status: RESOLVED MOVED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: Unsorted
Assignee: Philip Jägenstedt
QA Contact: contributor
URL: https://html.spec.whatwg.org/#text-tr...
Whiteboard:
Keywords:
: 28970 28971 28972 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-07-20 12:48 UTC by Philip Jägenstedt
Modified: 2019-03-29 19:59 UTC (History)
4 users (show)

See Also:


Attachments

Description Philip Jägenstedt 2015-07-20 12:48:48 UTC
https://html.spec.whatwg.org/#text-track-model

"Whenever a text track that is in a media element's list of text tracks has its text track mode change value, the user agent must run the following steps for the media element:"

This means that if a <track> element is first created and its text track's mode set to "showing" before appending it to the media element, these steps will not be run, and thus the "time marches on steps" steps which will cause any cues within to be shown will also not be run.

This illustrates the problem:

<video preload="auto">
  <source src="video.mp4" type="video/mp4">
  <source src="video.ogv" type="video/ogg">
</video>
<script>
var video = document.querySelector("video");

video.addEventListener("loadedmetadata", function() {
  video.currentTime = 1;
});

video.addEventListener("seeked", function() {
  var bug = true;
  var track;
  if (bug) {
    var trackElement = document.createElement("track");
    trackElement.kind = "subtitles";
    track = trackElement.track;
  } else {
    track = video.addTextTrack("subtitles");
  }
  track.addCue(new VTTCue(0, 10, "text"));
  track.mode = "showing";
  if (bug) {
    video.appendChild(trackElement);
  }
});
</script>

The main point being that it's unfortunate that the order of setting track.mode and appending trackElement should matter at all.

Of course, script-created tracks "should" be added with HTMLMediaElement.addTextTrack(), but it is still possible to add <track> elements and use their internal TextTracks instead.
Comment 1 Philip Jägenstedt 2015-07-20 12:50:37 UTC
*** Bug 28970 has been marked as a duplicate of this bug. ***
Comment 2 Philip Jägenstedt 2015-07-20 12:50:59 UTC
*** Bug 28971 has been marked as a duplicate of this bug. ***
Comment 3 Philip Jägenstedt 2015-07-20 12:51:08 UTC
*** Bug 28972 has been marked as a duplicate of this bug. ***
Comment 4 Philip Jägenstedt 2015-07-20 14:09:13 UTC
AFAICT, any later invocation of the "time marches on" steps would cause the cue to be rendered, which makes me think this is not a deliberate limitation of <track> elements.
Comment 5 Domenic Denicola 2019-03-29 19:59:41 UTC
https://github.com/whatwg/html/issues/4471