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

HTML-Referenzhandbuch

HTML-Tag-Übersicht

HTML Audio/Video DOM autoplay Eigenschaft

Die Eigenschaft autoplay von HTMLMediaElement entspricht der HTML-Eigenschaft autoplay und gibt an, ob das Video automatisch wiedergegeben wird, wenn genügend Mediendateien zum Abspielen heruntergeladen wurden. Hinweis: Einige Versionen von Chrome unterstützen nur autostart, nicht autoplay

 HTML Audio/Video DOM Reference Manual

Online-Beispiel

Aktivieren Sie die automatische Wiedergabe und laden Sie das Video neu:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML     Audio/Verwendung der     audioTracks -Eigenschaft-Grundtutorials(oldtoolbag.com)</title>
</head>
<body>
<button onclick="enableAutoplay()" type="button">Automatische Wiedergabe aktivieren</button>
<button onclick="disableAutoplay()" type="button">Automatische Wiedergabe deaktivieren</button>
<button onclick="checkAutoplay()" type="button">Überprüfen Sie den Zustand der automatischen Wiedergabe</button>
<br> 
<video id="video1" controls="controls">
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.ogg" type="video/ogg">
  Ihr Browser unterstützt keine     HTML5 video     Etikett.
</video>
<script>
myVid=document.getElementById("video1");
function enableAutoplay()
{ 
  myVid.autoplay=true;
  myVid.load();
} 
function disableAutoplay()
{ 
  myVid.autoplay=false;
  myVid.load();
} 
function checkAutoplay()}
{ 
  alert(myVid.autoplay);
} 
</script> 
</body>
</html>
Test and see ‹/›

Definition and Usage

The autoplay attribute sets or returns whether the audio is loaded/Play video immediately after.

Browser Compatibility

IEFirefoxOperaChromeSafari

All major browsers support the autoplay attribute.

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

Syntax

Set autoplay attribute:

audio|video.autoplay=true|false

Return autoplay attribute:

audio|video.autoplay

Attribute value

ValueDescription
trueIndicates audio/The video should start playing immediately after loading.
falseDefault. Indicates audio/The video should not start playing immediately after loading.

Technical Details

Return value:Boolean value, true|false
Default value:false
 HTML Audio/Video DOM Reference Manual