How to change the playing speed of videos in HTML5?


Use the playbackRate property sets the current playback speed of the audio/video. With that, the defaultPlaybackRate property sets the default playback speed of the audio/video.

Change the playing speed of videos

You can try to run the following code to change the playing speed of videos −

/* play video thrice as fast */
document.querySelector('video').defaultPlaybackRate = 3.0;
document.querySelector('video').play();

Play video twice as fast

The following is to play the video twice as fast −

/* play video twice as fast */
document.querySelector('video').playbackRate = 2;

Updated on: 21-Nov-2023

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements