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 code | Description |
---|---|
S_OK | The operation completed successfully. |
IndexSizeError | The 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
Mozilla Developer Network : Article
Microsoft Developer Network: Windows Internet Explorer API reference Article