How to change the playback speed of a video in HTML5?

王林
Release: 2023-09-16 13:45:03
forward
1681 people have browsed it

How to change the playback speed of a video in HTML5?

Use theplaybackRateproperty to set the current playback speed of audio/video. Through this attribute, thedefaultPlaybackRateattribute sets the default playback speed of audio/video.

You can try running the following code to change the playback speed of the video −

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

Here’s how to play the video at twice the speed −

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

The above is the detailed content of How to change the playback speed of a video in HTML5?. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!