This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

startTime

Summary

The text track cue start time, in seconds.

Property of apis/audio-video/TextTrackCueapis/audio-video/TextTrackCue

Syntax

var result = TextTrackCue.startTime;
TextTrackCue.startTime = value;

Return Value

Returns an object of type NumberNumber

Examples

This example adds start times, end times, and captions to a track.

<!DOCTYPE html >
<html >
  <head>
    <title>Add Text Tracks example</title>
</head>
<body>

<video id="video1" controls="controls" muted="muted">
     <!-- change to your own mp4 video file -->
  <source src="http://ie.microsoft.com/testdrive/Videos/BehindIE9ModernWebStandards/Video.mp4" />
  HTML5 Video not supported
</video>

 <script>
   var video = document.getElementById("video1");
   var startTime, endTime, message;
   var newTextTrack = video.addTextTrack("captions", "sample");
   newTextTrack.mode = newTextTrack.SHOWING; // set track to display
   // create some cues and add them to the new track
   for (var i = 0; i < 30; i++) {
     startTime = i * 5;
     endTime = ((i * 5) + 5);
     message = "This is number " + i;
     newTextTrack.addCue(new TextTrackCue(startTime, endTime, message));
   }
   video.play();
  </script>
</body>
</html>

Related specifications

W3C HTML5 Specification
W3C Editor’s Draft

Attributions