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

HTML Reference Manual

HTML Tag Directory

HTML Audio/Video DOM defaultPlaybackRate attribute

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

 HTML Audio/Video DOM Reference Manual

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 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 audio/The default playback speed of the 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

Only Internet Explorer 10Firefox and Chrome support the defaultPlaybackRate attribute.

Note:Safari, Opera, or Internet Explorer 9 Versions prior to and including this do not support the defaultPlaybackRate attribute.

Syntax

Set defaultPlaybackRate attribute:

audio|video.defaultPlaybackRate=playbackspeed

Return defaultPlaybackRate attribute:

audio|video.defaultPlaybackRate

Attribute value

ValueDescription
playbackspeedIndicate audio/The default playback speed of the video.
Example value:
  • 1.0 Normal speed

  • 0.5 Half speed (slower)

  • 2.0 at double speed (faster)

  • -1.0 Backward, normal speed

  • -0.5 Backward, half speed

Technical Details

Return value:Numeric value, the default playback speed
Default value:1.0
 HTML Audio/Video DOM Reference Manual