English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Das "duration"-Attribut gibt die Länge des Mediums in Sekunden an, wenn keine Mediumsdaten verfügbar sind, ist es null.
HTML Audio/Video DOM Reference Manual
Erhalten Sie die aktuelle Länge des Videos:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>HTML-Audio/Verwendung der Video-Dauerattribut-Grundtutorials(oldtoolbag.com)</title> </head> <body> <button onclick="getVidDur()" type="button">Erhalten Sie die aktuelle Länge des Videos: </button> <br> <video id="video1" controls="controls"> <source src="mov_bbb.mp4" type="video/mp4"> <source src="mov_bbb.ogg" type="video/ogg"> Your browser does not support HTML5 video Tag. </video> <script> myVid=document.getElementById("video1"); function getVidDur() { alert(myVid.duration); } </script> </body> </html>Test to see ‹/›
The duration property returns the current audio/Length of the video, in seconds.
If the audio is not set/If the duration of the video is not set, it returns NaN (not a number).
Note: This property is read-only.
IEFirefoxOperaChromeSafari
All major browsers support the duration property.
Note:Internet Explorer 8 and earlier versions do not support this property.
audio|video.duration
Return value: | Numeric value representing the audio/Length of the video, in seconds. |
---|