Computer >> Computer tutorials >  >> Programming >> HTML

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.

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();

The following is to play the video twice as fast −

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