<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>28973</bug_id>
          
          <creation_ts>2015-07-20 12:48:48 +0000</creation_ts>
          <short_desc>&lt;track&gt; elements added with their text track already showing do not run the &quot;time marches on&quot; steps</short_desc>
          <delta_ts>2019-03-29 19:59:41 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WHATWG</product>
          <component>HTML</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>MOVED</resolution>
          
          
          <bug_file_loc>https://html.spec.whatwg.org/#text-track-model</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>Unsorted</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Philip Jägenstedt">philipj</reporter>
          <assigned_to name="Philip Jägenstedt">philip</assigned_to>
          <cc>annevk</cc>
    
    <cc>contributor</cc>
    
    <cc>d</cc>
    
    <cc>mike</cc>
          
          <qa_contact>contributor</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>122225</commentid>
    <comment_count>0</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2015-07-20 12:48:48 +0000</bug_when>
    <thetext>https://html.spec.whatwg.org/#text-track-model

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

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

This illustrates the problem:

&lt;video preload=&quot;auto&quot;&gt;
  &lt;source src=&quot;video.mp4&quot; type=&quot;video/mp4&quot;&gt;
  &lt;source src=&quot;video.ogv&quot; type=&quot;video/ogg&quot;&gt;
&lt;/video&gt;
&lt;script&gt;
var video = document.querySelector(&quot;video&quot;);

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

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

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

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

    </bug>

</bugzilla>