Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

How to change video playing speed using JavaScript ?

  • Last Updated : 12 Jan, 2021

In this article, we will see how we can change playback speed of videos embedded in an HTML document using an HTML5 video tag.

We can set the new playing speed using playbackRate attribute. It has the following syntax.

Hey geek! The constant emerging technologies in the world of web development always keeps the excitement for this subject through the roof. But before you tackle the big projects, we suggest you start by learning the basics. Kickstart your web development journey by learning JS concepts with our JavaScript Course. Now at it's lowest price ever!


let video = document.querySelector('video')
video.playbackRate = newPlaybackRate

We can also set the default playing speed using defaultPlaybackRate attribute. It has the following syntax.


 let video = document.querySelector('video')
 video.defaultPlaybackRate = 4



<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <meta name="viewport" content=
        "width=device-width, initial-scale=1.0">
        body {
            text-align: center;
            margin-top: 2%;
        h1 {
            color: green;
        p {
            margin-top: 2%;
        button {
            margin-right: 20px;
    <video width="890" height="500" controls loop>
        <source src="sample.mp4" type="video/mp4">
        Your browser does not support the video tag.
        <button onclick="increase()">Increase Speed</button>
        <button onclick="decrease()">Decrease Speed</button>
        let video = document.querySelector('video');
        // Set the default playing speed
        video.defaultPlaybackRate = 0.5
        // Loading the video after setting 
        function increase() {
            // Increasing the playing speed by 1
            video.playbackRate += 1;
        function decrease() {
            // Decreasing the playing speed by 1
            if (video.playbackRate > 1)
                video.playbackRate -= 1;


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!