Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

startTime property

Returns the text track cue start time in seconds.

This property is read-only.

HTML5 A vocabulary and associated APIs for HTML and XHTMLInternet Explorer 10

 

Syntax

JavaScript
time = object.startTime

 

Property values

Type: number

Floating point value in seconds of starting time of a text track cue.

Standards information

Remarks

The startTime property may include fractional seconds.

Note  To create timed text files in both Web Video Text Track (WebVTT) and Timed Text Markup Language (TTML) formats, see HTML5 Video Caption Maker on the Windows Internet Explorer test drive site.

Examples

The following example creates an event listener that updates a div element with the current start and end times, and track text.


  <script type="text/javascript">
    // don't add this listener until all DOM content is loaded 
    document.addEventListener("DOMContentLoaded", function () {  
      var track = document.getElementById("track1");
      track.addEventListener("cuechange", function () {
        var myTrack = this.track;             
        var myCues = myTrack.activeCues;      // array of current cues.                                                    
        //  display the start and end time, and cue text
        if (myCues.length > 0) {
          var disp = document.getElementById("display");
          disp.innerHTML = myCues[0].startTime + " --> " + myCues[0].endTime + "  " + myCues[0].getCueAsHTML().textContent;
        }
      }, false);
    }, false);
  </script>
  </head>
<body>
  <video id="video1" controls>
    <source src="video.mp4"  > 
    <track id="track1" label="English subtitles" kind="captions" src="entrack.vtt" srclang="en" default>
  HTML5 video is not supported
  </video>
  <div id="display"></div>


See also

getCueAsHTML
TextTrackCue
Make your videos accessible with Timed Text Tracks

 

 

Show:
© 2015 Microsoft