Software Archive
Read-only legacy content
17060 Discussions

HTML5 <video> playbackRate not working

Rick_F_
Beginner
2,783 Views

According to the Intel document at: https://software.intel.com/sites/default/files/managed/d8/a6/fast-track-to-intel-xdk-new-unit08-media.pdf, page 8-5, the HTML5 video tag playbackRate method/property is read/writeable, but when tested via:

//  load video file from input field
function loadVideo(url) {
    var fileURL = url;  // get input field                    
    if (fileURL !== ""){
        videoPlayer.src = fileURL;
        videoPlayer.load(); 
        videoPlayer.playbackRate = 0.2;
        videoPlayer.play();
    } else {
       console.log('File for play did not work.');
    }
}

the playbackRate setting is ignored and video file is played back at normal speed, vice at the reduced speed setting. What gives here, is this not supported in Android Crosswalk? If not, why not? My client requires that this works as it is part of the HTML5 video tag standard.

0 Kudos
12 Replies
John_F_3
New Contributor I
2,783 Views

Hi Rick,

This is an important feature for one of my apps as well so I tested with the following code inserted into a blank project:

<button onclick="getPlaySpeed()" type="button">What is the playback speed?</button>
<button onclick="setPlaySpeed()" type="button">Set video to be play in slow motion</button><br> 

<video id="myVideo" width="320" height="176" controls>
  <source src="http://vjs.zencdn.net/v/oceans.mp4" type="video/mp4">
  <source src="http://vjs.zencdn.net/v/oceans.ogg" type="video/ogg">
  Your browser does not support HTML5 video.
</video>

<script>
var vid = document.getElementById("myVideo");

function getPlaySpeed() { 
    alert(vid.playbackRate);

function setPlaySpeed() { 
    vid.playbackRate = 0.2;

</script> 

The video plays exactly as it should at speed 1 but the playbackRate change has no effect on the Android Cordova build. I am running Android 4.2.2. Quirk in running this on a webpage is you must set the playbackRate _before_ starting play in order for it to take effect.

I did find this sad note in the Google docs "Neither playbackRate (see demo) nor volume are supported on mobile."

0 Kudos
PaulF_IntelCorp
Employee
2,783 Views

Did you try using Crosswalk version 10?

Crosswalk is directly derived from the Chromium/Blink project, so it should reflect [most of] the capabilities in the equivalent version of Chrome. Crosswalk 10 is based on Chrome 39.

0 Kudos
Rick_F_
Beginner
2,783 Views

Paul,

Thank you for your reply. My build settings for my Android Crosswalk build is set for Crosswalk version 10. This issue is presented in both Debug and in a built application (Crosswalk for Android). 

0 Kudos
John_Jairo_B_
Beginner
2,783 Views

Good Afternoon Everyone

The links disappeared fast track anyone knows where they went

0 Kudos
Rick_F_
Beginner
2,783 Views

John F. I too note that on the Google Samples Demo that you linked to that playBackRate is not supported on Chrome mobile, as tested on my device. So I guess we need to contact Google or..? 

John Jairo B. I think Intel removed them. Perhaps someone at Intel can comment??

0 Kudos
Rick_F_
Beginner
2,783 Views

Version 1878, HTML5 slow motion playback via rate change still not working. Is anyone working on this???

0 Kudos
PaulF_IntelCorp
Employee
2,783 Views

The rate at which video plays back is not dependent on the XDK or the XDK version, it is a function of the webview. See this blog for some background: http://blogs.intel.com/evangelists/2014/09/02/html5-web-app-webview-app/

Also, Crosswalk 11 and 12 have been added to the build system, give those a try.

Regarding that "fast track" document, our documentation has been going through upgrades and obsolete docs (especially those that refer to the legacy container) have been retired.

0 Kudos
Ian_Devlin
Beginner
2,783 Views

Sadly the playbackRate attribute is not well supported by browsers/webviews so it's best not to use it.

0 Kudos
Rick_F_
Beginner
2,783 Views

Paul, 

I have tried both Crosswalk 11 and 12 to no avail, yet my code works in Chrome and other browsers. Thank you for the link to the article, however I had read it before, hence my first question which is partially answered by this statement in the linked article: 

Because the Crosswalk webview is actually delivered as part of your app you know precisely what you’re getting on any Android device that runs your app. The Crosswalk webview is based on a recent version of the Chromium project and includes the Cordova hybrid app framework. So it is both up-to-date and extensible beyond the boundaries of a standard browser.

Ian, 

Your opinion regarding browser support for playbackRate is based on what documentation? Obviously not the HTML5 specs or Crosswalk documentation. In my original post I state that we are using Crosswalk, not any browser, so I do not understand your answer. Crosswalk states that they support playbackRate, even in versions 11 and 12. To see if your browser supports playbackRate, check out this JS demo: http://jsbin.com/xixaqedodo/1/edit 

0 Kudos
PaulF_IntelCorp
Employee
2,783 Views

We have a feature coming (not sure precisely when, but I have tested it) that allows you to use Chromium flags. In this case, you'd probably want to build it with the --show-fps-counter flag. I'll try to append to this thread when that version of the build system becomes available.

0 Kudos
Sean_M_
Beginner
2,783 Views

Has anything else come out of reviewing the playbackRate for the video tag in html5?  My company was looking at trying to use crosswalk to have the playbackRate functionality for video as well, but the cordova plugin for android(v1.3.0) still doesn't seem to support it, or am I missing something on how to correctly apply it?

0 Kudos
PaulF_IntelCorp
Employee
2,783 Views

What Cordova plugin are you referring to? There are hundreds out there...

0 Kudos
Reply