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 GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
duration

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

같이 보기