Javascript examples for DOM HTML Element:Video
The playbackRate property sets or gets the current playback speed of the video.
Set the playbackRate property with the following Values
Value | Description |
---|---|
playbackspeed | Indicates the current playback speed of the video. |
Example values:
A Number, representing the current playback speed
The following code shows how to Set a video to play in slow motion:
<!DOCTYPE html> <html> <body> <video id="myVideo" width="320" height="240" controls> <source src="your.mp4" type="video/mp4"> <source src="your.ogg" type="video/ogg"> Your browser does not support the video tag. </video><br> <button onclick="getPlaySpeed()" type="button">What is playback speed?</button> <button onclick="setPlaySpeed()" type="button">Set video to be play fast</button> <script> var x = document.getElementById("myVideo"); function getPlaySpeed() {// w w w .j av a 2s. c om console.log(x.playbackRate); } function setPlaySpeed() { x.playbackRate = 5; } </script> </body> </html>