English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Referenzhandbuch

Vollständiges Verzeichnis der HTML-Tags

HTML Audio/Video DOM currentTime Attribut

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

Online-Beispiel

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 ‹/›

Definition and Usage

currentTime property sets or returns audio/Current position of video playback (in seconds).
When setting this property, playback will jump to the specified position.

Browser Compatibility

IEFirefoxOperaChromeSafari

All major browsers support the currentTime property.

Note:Internet Explorer 8 and earlier versions do not support this property.

Syntax

Set currentTime property:

audio|video.currentTime="seconds"

Return currentTime property:

audio|video.currentTime

Attribute value

ValueDescription
secondsIndicate audio/Current position of video playback, in seconds.

Technical Details

Return value:Numeric value, representing seconds
 HTML Audio/Video DOM Reference Manual