HTMLMediaElement: duration プロパティ
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
HTMLMediaElement
の読み取り専用プロパティ duration
は、この要素のメディアの長さを秒単位で表します。
値
メディアの再生時間を秒単位で示す倍精度浮動小数点値。メディアデータがない場合、値 NaN
を返します。ライブメディアストリームのように、要素のメディアの再生時間が不明な場合、 duration
の値は +Infinity
となります。
例
js
const obj = document.createElement("video");
console.log(obj.duration); // NaN
仕様書
Specification |
---|
HTML # dom-media-duration-dev |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
duration |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
関連情報
- ウェブメディア技術
HTMLMediaElement.currentTime
: メディアの現在の再生位置<audio>
および<video>
要素