Name
TimeRanges — a set of media time ranges
Synopsis
The buffered, played, and seekable properties of a MediaElement represent
the portions of a media timeline that have data buffered, that have
been played, and that playback can be started at. Each of these
portions of the timeline may include multiple disjoint time ranges
(this happens to the played
property when the user skips to the middle of a video file, for
example). A TimeRanges object represents zero or more disjoint time
ranges. The length property
specifies the number of ranges, and the start() and end() methods return the bounds of each
range.
The TimeRanges objects
returned by MediaElements are always
normalized, which means that the ranges
they contain are in order, nonempty and do not touch or
overlap.
Properties
readonly unsigned longlengthThe number of ranges represented by this TimeRanges object.
Methods
double end(unsigned long
n)
end(unsigned long
n)Returns the end time (in seconds) of time range
n, or throws an exception if
n is less than zero or greater than or
equal to length.
double start(unsigned long
n)
start(unsigned long
n)Returns the start time (in seconds) of time range
n, or throws an exception if
n is less than zero or greater than or
equal to length.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access