English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The defaultPlaybackRate attribute indicates the default playback rate of the media.
HTML Audio/Video DOM Reference Manual
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 ‹/›
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.
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.
Set defaultPlaybackRate attribute:
audio|video.defaultPlaybackRate=playbackspeed
Return defaultPlaybackRate attribute:
audio|video.defaultPlaybackRate
Value | Description |
---|---|
playbackspeed | Indicate audio/The default playback speed of the video. Example value:
|
Return value: | Numeric value, the default playback speed |
---|---|
Default value: | 1.0 |