Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 539455 of TimeRanges

  • Revision slug: Web/API/TimeRanges
  • Revision title: TimeRanges
  • Revision id: 539455
  • Created:
  • Creator: teoli
  • Is current revision? No
  • Comment

Revision Content

{{ APIRef }}

{{ gecko_minversion_header("2.0") }}

The TimeRanges interface is used to represent a set of time ranges, primarily for the purpose of tracking which portions of media have been buffered when loading it for use by the {{ HTMLElement("audio") }} and {{ HTMLElement("video") }} elements.

A TimeRanges object includes one or more ranges of time, each specified by a starting and 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.

The term "normalized TimeRanges object" indicates that ranges in such an object are ordered, don't overlap, aren't empty, and don't touch (adjacent ranges are folded into one bigger range).

Properties

Name Description Return Type Availability
TimeRanges.length The number of time ranges represented by the time range object. Read only.

unsigned long

?

Methods

{{ domxref("TimeRanges.start") }}
Returns the time for the start of the range with the specified index.
{{ domxref("TimeRanges.end") }}
Returns the time for the end of the specified range.

Specification

Revision Source

<p>{{ APIRef }}</p>
<p>{{ gecko_minversion_header("2.0") }}</p>
<p>The <code>TimeRanges</code> interface is used to represent a set of time ranges, primarily for the purpose of tracking which portions of media have been buffered when loading it for use by the {{ HTMLElement("audio") }} and {{ HTMLElement("video") }}&nbsp;elements.</p>
<p>A <code>TimeRanges</code> object includes one or more ranges of time, each specified by a starting and ending time offset. You reference each time range by using the <code>start()</code> and <code>end()</code> methods, passing the index number of the time range you want to retrieve.</p>
<p>The term "<a class="external" href="https://www.w3.org/TR/html5/the-iframe-element.html#normalized-timeranges-object" title="https://www.w3.org/TR/html5/the-iframe-element.html#normalized-timeranges-object">normalized TimeRanges object</a>" indicates that ranges in such an object are ordered, don't overlap, aren't empty, and don't touch (adjacent ranges are folded into one bigger range).</p>
<h3 id="Properties" name="Properties">Properties</h3>
<table class="standard-table">
 <tbody>
  <tr>
   <th>Name</th>
   <th>Description</th>
   <th>Return Type</th>
   <th>Availability</th>
  </tr>
  <tr>
   <td><a href="/en/DOM/TimeRanges.length" title="En/DOM/TimeRanges.length"><code>TimeRanges.length</code></a></td>
   <td>The number of time ranges represented by the time range object. <strong>Read only.</strong></td>
   <td>
    <p>unsigned long</p>
   </td>
   <td>?</td>
  </tr>
 </tbody>
</table>
<h3 id="Methods" name="Methods">Methods</h3>
<dl>
 <dt>
  {{ domxref("TimeRanges.start") }}</dt>
 <dd>
  Returns the time for the start of the range with the specified index.</dd>
 <dt>
  {{ domxref("TimeRanges.end") }}</dt>
 <dd>
  Returns the time for the end of the specified range.</dd>
</dl>
<h3 id="Specification">Specification</h3>
<ul>
 <li><a class="external" href="https://www.whatwg.org/specs/web-apps/current-work/#timeranges" title="https://www.whatwg.org/specs/web-apps/current-work/#timeranges">WHATWG Working Draft</a></li>
</ul>
Revert to this revision