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 2015年7月.
HTMLMediaElement の読み取り専用プロパティ duration は、この要素のメディアの長さを秒単位で表します。
値
メディアの再生時間を秒単位で示す倍精度浮動小数点値。メディアデータがない場合、値 NaN を返します。ライブメディアストリームのように、要素のメディアの再生時間が不明な場合、 duration の値は +Infinity となります。
例
js
const obj = document.createElement("video");
console.log(obj.duration); // NaN
仕様書
| Specification |
|---|
| HTML> # dom-media-duration-dev> |
ブラウザーの互換性
Loading…
関連情報
- ウェブメディア技術
HTMLMediaElement.currentTime: メディアの現在の再生位置<audio>および<video>要素