Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. HTMLMediaElement
  4. duration

HTMLMediaElement: duration property

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⁩.

Theread-onlyHTMLMediaElementpropertyduration indicates the length of the element'smedia in seconds.

Value

A double-precision floating-point value indicating the duration of the media inseconds. If no media data is available, the valueNaN is returned. If theelement's media doesn't have a known duration—such as for live media streams—the valueofduration isInfinity.

Examples

js
const obj = document.createElement("video");console.log(obj.duration); // NaN

Specifications

Specification
HTML
# dom-media-duration-dev

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp