This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

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

브라우저 호환성

같이 보기