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

HTML Reference Manual

HTML Tag Reference

HTML Audio/Video DOM defaultPlaybackRate Attribute

The defaultPlaybackRate attribute indicates the default playback rate of the media.

 Manuale di riferimento DOM Audio/Video HTML

Online Example

Set video to default slow motion:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML Audio/Video defaultPlaybackRate Attribute Usage - Basic Tutorial (oldtoolbag.com)</title>
</head>
<body>
<button onclick="getPlaySpeed()" type="button">What is the default playback speed?</button>
<button onclick="setPlaySpeed()" type="button">Set video to default slow playback</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 the HTML5 video tag.
</video>
<script>
myVid=document.getElementById("video1");
function getPlaySpeed()
{ 
  alert(myVid.defaultPlaybackRate);
} 
function setPlaySpeed()
{ 
  myVid.defaultPlaybackRate=0.5;
  myVid.load();
} 
</script> 
</body>
</html>
Test and see <‹/›

Definition and Usage

defaultPlaybackRate property to set or return the default playback speed of audio/video.
Setting this property will only change the default playback speed without changing the current playback speed. To change the current playback speed, please use playbackRate.

browser compatibility

IEFirefoxOperaChromeSafari

Solo Internet Explorer 10, Firefox e Chrome supportano l'attributo defaultPlaybackRate.

Attenzione:Safari, Opera o Internet Explorer 9 e precedenti versioni non supportano l'attributo defaultPlaybackRate.

Sintassi

Imposta l'attributo defaultPlaybackRate:

audio|video.defaultPlaybackRate=playbackspeed

Restituisce l'attributo defaultPlaybackRate:

audio|video.defaultPlaybackRate

Valore dell'attributo

ValoreDescrizione
playbackspeedIndica la velocità di riproduzione predefinita dell'audio/video.
Esempio di valore:
  • 1.0 Velocità normale

  • 0.5 Mezza velocità (più lenta)

  • 2.0 Velocità doppia (più veloce)

  • -1.0 Indietro, velocità normale

  • -0.5 Indietro, mezza velocità

Dettagli tecnici

Valore di ritorno:Valore numerico, velocità di riproduzione predefinita
Valore predefinito:1.0
 Manuale di riferimento DOM Audio/Video HTML