Change the video playback speed using video.js

html5-videovideo.js

Is there any existing plugin to change the playback rate of a video using the video.js player? If not, how can I add the new plugin and the new control button for the same?

Thanks in advance.

Best Answer

From videojs v.4.6.0 on there is a JSON parameter for data-setup that you can pass to add the playback speed option to the videoplayer:

<video id="my_video_1" class="video-js vjs-default-skin" controls 
preload="auto" width="640" height="268" 
data-setup='{ "playbackRates": [0.5, 1, 1.5, 2] }'>

Demo: http://jsbin.com/vikun/1/edit?html,output

Credits: https://stackoverflow.com/a/24767026/1066234

Note: You must use double quotes for the parameters within data-setup.

-

Helpful: If you need to change the speed after the videoplayer is ready (Jquery), use:

var video = videojs('videoplay', options);

video.ready(function() {
    // faster speed initially
    this.playbackRate(1.5);
});