Syntax error How to change the playing speed of videos in HTML5?

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: 2023-11-21T21:00:26+05:30

3K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements