English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The HTMLMediaElement playbackRate attribute sets the playback rate of the media file. This is used to allow users to control fast forward, slow motion, and so on. The normal playback rate multiplied by this value represents the current playback rate, so10 represents a normal playback rate. Setting playbackRate to a negative value can achieve reverse playback. When the media file is played backward or the playback rate is lower or higher than the available range specified by the browser core (for example, the Gecko agreement range is 0.25~5At 0.0, the playback process will be muted. The pitch of the audio will match the playback rate by default at any playback rate. Some browsers implement the non-standard preservespitch attribute for pitch control.
HTML Audio/Video DOM Reference Manual
Set video playback to slow:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>HTML Audio/HTML video playbackRate attribute usage-Basic Tutorial(oldtoolbag.com)</title>/<title> </<head> <body> <button onclick="getPlaySpeed()" type="button">What is the playback speed?</button> <button onclick="setPlaySpeed()" type="button">Set video playback to slow</button> <br> <video id="video1" controls="controls"> <source src="movie.mp4" type="video/mp4"> <source src="movie.ogg" type="video/ogg"> Your browser does not support HTML5 video tag. </video> <script> myVid=document.getElementById("video1"); function getPlaySpeed() { alert(myVid.playbackRate); } function setPlaySpeed() { myVid.playbackRate=0.5; } </script> </body> </html>Test and see ‹/›
playbackRate attribute sets or returns audio/Current playback speed of the video.
IEFirefoxOperaChromeSafari
All major browsers support the playbackRate attribute.
Note:Internet Explorer 9 Versions prior to and including do not support the playbackRate attribute.
Set playbackRate attribute:
audio|video.playbackRate=playbackspeed
Return playbackRate attribute:
audio|video.playbackRate
Value | Description |
---|---|
playbackspeed | Indicate audio/Current playback speed of the video. Example value:
|
Return value: | Numeric value, current playback speed |
---|---|
Default value: | 1.0 |