EN
Il contenuto non è disponibile nella lingua di destinazione, ma solo in inglese.

HTMLTimeRanges object

Stores a collection of ranges (periods) of time.

HTML5 A vocabulary and associated APIs for HTML and XHTML, Section 4

Members

The HTMLTimeRanges object has these types of members:

Methods

The HTMLTimeRanges object has these methods.

MethodDescription
end

Returns the end of the time range by using the specified index.

start

Gets the start of the time range by using the specified index.

 

Properties

The HTMLTimeRanges object has these properties.

PropertyDescription

length

The number of time ranges in the collection.

 

Standards information

Remarks

A HTMLTimeRanges object represents the collection of ranges from the media resource that have been buffered or played. Ranges in a HTMLTimeRanges collection are sequential and not empty. Adjacent ranges are combined together to create longer ones.

Examples

The following script shows how to access the list of ranges that have been played.


var ranges = document.getElementById('myVideo').played;
for (var i=0; i<ranges.length; i++){
    var start = ranges.start(i);
    var end = ranges.end(i);
    // display results to developer tools console window
    if (window.console.log){ 
      window.console.log("Played from " + start + " to " + end); 
    }
}

See also

Reference
buffered
played
seekable

 

 

Mostra:
© 2014 Microsoft