Why video defaultPlaybackRate doesn't work in Chrome?

I saw some examples of defaultPlaybackRate and they say it work on Chrome. So I use their example codes and run on Chrome, it doesn't change the speed to 3.0x when I click the button. Anyone can tell me why?

Here my javascript code,

$(document).ready(function(){

    var video = document.getElementById('video');

    $("#speed").click(function() { // button function for 3x fast speed
            video.defaultPlaybackRate=3.0;
    });

});

The HTML codes,

<button id="speed" type="button">3.0x</button>

and

<video id="video" width="930" height="500" controls>
        <source src="caption.mp4" type="video/mp4">
        <source src="caption.ogg" type="video/ogg" >
        <source src="caption.webm" type="video/webm" >
</video> 

Answers


Because once you change the defaultPlaybackRate you have to load the video again using video.load(); (or set it before the video has loaded). If you want to change the rate while the video plays, use playbackRate instead.

 var video = document.getElementById('video');
 $("#speed").click(function () { // button function for 3x fast speed
     video.defaultPlaybackRate = 3.0;
     video.load();
 });

or

 var video = document.getElementById('video');
 $("#speed").click(function () { // button function for 3x fast speed
     video.playbackRate  = 3.0;
 });

jsFiddle example


Need Your Help

“full width yen” or CNY

format locale chinese-locale

We are formatting the price received from Apple for an IAP ID into the currency of the product using the product.pricelocale value.

Internal Error: Image is a collection image,expecting ADT with Oracle

oracle spring jdbc spring-jdbc

I am trying to call a stored function on an oracle database with spring-jdbc.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.