Export (0) Print
Expand All

endTime property

Returns the ending time, in seconds, for a text track cue.

This property is read-only.

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

Syntax

JavaScript
time = object.endTime

Property values

Type: number

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

Standards information

Remarks

The following example creates an event listener that displays the current start and end times, and cue text as a video plays.

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


  <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:
© 2014 Microsoft