Video defaultPlaybackRate Property - Set the video to play faster by default: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Video

Description

Video defaultPlaybackRate Property - Set the video to play faster by default:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<video id="myVideo" width="320" height="240" controls>
  <source src="your.mp4" type="video/mp4">
  <source src="your.ogg" type="video/ogg">
  Your browser does not support the video tag.
</video><br>

<button onclick="getPlaySpeed()" type="button">What is the default playback speed?</button>
<button onclick="setPlaySpeed()" type="button">Set video to be play faster</button>

<script>
var x = document.getElementById("myVideo");
function getPlaySpeed() {//from www .  j ava2 s .c  om
    console.log(x.defaultPlaybackRate);
}

function setPlaySpeed() {
    x.defaultPlaybackRate = 5;
    x.load();
}
</script>

</body>
</html>

Related Tutorials