---
title: duration
framework: webkitjs
role: symbol
role_heading: Instance Property
path: webkitjs/htmlmediaelement/1630916-duration
---

# duration

The length of the media resource in seconds. (read-only)

## Declaration

```data
readonly attribute unrestricted double duration;
```

## Discussion

Discussion This property is 0 if there is no media data available. This property is NaN if the duration is unknown. The value is positive infinity if the duration is known but is indefinite—for example, a live stream.

## See Also

### Getting State

- [buffered](webkitjs/htmlmediaelement/1628987-buffered.md)
- [currentSrc](webkitjs/htmlmediaelement/1633960-currentsrc.md)
- [ended](webkitjs/htmlmediaelement/1630452-ended.md)
- [error](webkitjs/htmlmediaelement/1630743-error.md)
- [networkState](webkitjs/htmlmediaelement/1633289-networkstate.md)
- [paused](webkitjs/htmlmediaelement/1631769-paused.md)
- [played](webkitjs/htmlmediaelement/1629079-played.md)
- [readyState](webkitjs/htmlmediaelement/1632439-readystate.md)
- [seekable](webkitjs/htmlmediaelement/1633602-seekable.md)
- [seeking](webkitjs/htmlmediaelement/1634314-seeking.md)
- [startTime](webkitjs/htmlmediaelement/1805533-starttime.md)
