---
title: "TimeRanges | JavaScript maps SDK"
description: "Documentation for MapTiler SDK"
---

> For AI agents: a documentation index is available at [/llms.txt](https://docs.maptiler.com/llms.txt). Markdown versions of all pages are available by appending .md to any URL.

# Interface TimeRanges

When loading a media resource for use by an

or 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.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/TimeRanges)

interface TimeRanges {  
    [length](#length): number;  
    [end](#end-1)(index: number): number;  
    [start](#start-1)(index: number): number;  
}

##### Index

### Properties[](#properties)

[length](#length)

### Methods[](#methods)

[end](#end) [start](#start)

## Properties[](#properties-1)

### `Readonly`length[](#length)

length: number

The **`TimeRanges.length`** read-only property returns the number of ranges in the object.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/TimeRanges/length)

## Methods[](#methods-1)

### end[](#end)

-   end(index: number): number[](#end-1)
    
    The **`end()`** method of the TimeRanges interface returns the time offset (in seconds) at which a specified time range ends.
    
    [MDN Reference](https://developer.mozilla.org/docs/Web/API/TimeRanges/end)
    
    #### Parameters
    
    -   index: number
    
    #### Returns number
    

### start[](#start)

-   start(index: number): number[](#start-1)
    
    The **`start()`** method of the TimeRanges interface returns the time offset (in seconds) at which a specified time range begins.
    
    [MDN Reference](https://developer.mozilla.org/docs/Web/API/TimeRanges/start)
    
    #### Parameters
    
    -   index: number
    
    #### Returns number
