HTML DOM Video load( ) Method


The HTML DOM Video load() is used for re-rendering of video element after its certain attributes get updated by user such as ‘src’.

Syntax

Following is the syntax −

videoObject.load()

Let us see an example of Video load() property −

Example

Live Demo

<!DOCTYPE html>
<html>
<head>
<title>HTML DOM Video load()</title>
<style>
   * {
      padding: 2px;
      margin:5px;
   }
   form {
      width:70%;
      margin: 0 auto;
      text-align: center;
   }
   input[type="button"] {
      border-radius: 10px;
   }
</style>
</head>
<body>
   <form>
      <fieldset>
         <legend>HTML-DOM-Video-load( )</legend>
         <video id="demo" width="320" controls><source    src="http://www.tutorialspoint.com/html5/foo.mp4" type="video/mp4"></video><br>
         <input type="button" onclick="getTrackDetails(1)" value="Slow (<<)">
         <input type="button" onclick="getTrackDetails(2)" value="Fast (>>)">
         <div id="divDisplay"></div>
      </fieldset>
   </form>
<script>
   var divDisplay = document.getElementById("divDisplay");
   var demo = document.getElementById("demo");
   function getTrackDetails(val) {
      if(val === 1){
         demo.defaultPlaybackRate -= 0.5;
         demo.load();
         divDisplay.textContent = 'Default Playback Set: '+demo.defaultPlaybackRate;
      }
      else{
         demo.defaultPlaybackRate += 0.5;
         demo.load();
         divDisplay.textContent = 'Default Playback Set: '+demo.defaultPlaybackRate;
      }
   }
</script>
</body>
</html>

Output

Clicking ‘Fast (>>)’ button 2 times −

Clicking ‘Slow (<<)’ button −

Updated on: 18-Feb-2021

99 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements