docs.rodeo

MDN Web Docs mirror

TimeRanges

{{APIRef("DOM")}} 

When loading a media resource for use by an {{HTMLElement("audio")}}  or {{HTMLElement("video")}}  element, the TimeRanges interface is used for representing the time ranges of the media resource that have been buffered, the time ranges that have been played, and the time ranges that are seekable.

A TimeRanges object includes one or more ranges of time, each specified by a starting time offset and an ending time offset. You reference each time range by using the start() and end() methods, passing the index number of the time range you want to retrieve.

Normalized TimeRanges objects

Several members of {{domxref("HTMLMediaElement")}}  objects return a normalized TimeRanges object — which the spec describes as having the following characteristics:

The ranges in such an object are ordered, don’t overlap, and don’t touch (adjacent ranges are folded into one bigger range). A range can be empty (referencing just a single moment in time).

Instance properties

Instance methods

Specifications

{{Specifications}} 

Browser compatibility

{{Compat}} 

In this article

View on MDN