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.

end

Summary

Returns the time for the end of the range with the given index. Throws an IndexSizeError if the index is out of range.

Method of apis/audio-video/TimeRangesapis/audio-video/TimeRanges

Syntax

var object = TimeRanges.end(index);

Parameters

index

Data-type
any

The zero-based index of the item in the collection.

Return Value

Returns an object of type DOM NodeDOM Node

Type: HRESULT. This method can return one of these values.

Return codeDescription
S_OKThe operation completed successfully.
IndexSizeErrorThe specified index is out of range.

Examples

Given a video element with the ID "myVideo", this example looks at the time ranges to determine if the entire video has been loaded.

var v = document.GetElementById("myVideo");

var buf = v.buffered;

var numRanges = buf.length;

if (buf.length == 1) {
  // only one range
  if (buf.start(0) == 0 && buf.end(0) == v.duration) {
    // The one range starts at the beginning and ends at
    // the end of the video, so the whole thing is loaded
    var videoLoaded = true;
  }
}

Related specifications

W3C HTML5 Specification
W3C Editor’s Draft

Attributions