English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Das currentTime-Attribut gibt die aktuelle Wiedergabezeit des Medienelements in Sekunden zurück. Die Änderung dieses Attributes ändert die aktuelle Wiedergabeposition des Medienelements.
HTML Audio/Video DOM Reference Manual
Setze Zeitposition auf 5 Sekunden:
<!DOCTYPE html> <html> <head> <meta charset="utf-8> <title>HTML-Audio/Verwendung der currentTime-Attribute des Videos-Grundlagen-Tutorial(oldtoolbag.com)</title>/<title> </<head> <body> <button onclick="getCurTime()" type="button">Erhalte aktuelle Zeitposition</button> <button onclick="setCurTime()" type="button">Setze Zeitposition auf 5 Sekunden</button> <br> <video id="video1" controls="controls"> <source src="movie.mp4" type="video/mp4> <source src="movie.ogg" type="video/> Ihr Browser unterstützt keine HTML5 video-Tag. </video> <script> myVid = document.getElementById("video"1; function getCurTime() { alert(myVid.currentTime); } function setCurTime()} { myVid.currentTime=5; } </script> </body> </html>Test and see ‹/›
currentTime property sets or returns audio/Current position of video playback (in seconds).
When setting this property, playback will jump to the specified position.
IEFirefoxOperaChromeSafari
All major browsers support the currentTime property.
Note:Internet Explorer 8 and earlier versions do not support this property.
Set currentTime property:
audio|video.currentTime="seconds"
Return currentTime property:
audio|video.currentTime
Value | Description |
---|---|
seconds | Indicate audio/Current position of video playback, in seconds. |
Return value: | Numeric value, representing seconds |
---|