HTML DOM Video paused Property


The HTML DOM Video paused property returns a boolean (true/false) corresponding to whether the video is playing or not.

Syntax

Following is the syntax −

Returning boolean value

mediaObject.paused

Let us see an example of HTML DOM Video paused property −

Example

Live Demo

<!DOCTYPE html>
<html>
<head>
<title>HTML DOM Video paused</title>
<style>
   * {
      padding: 2px;
      margin:5px;
   }
   form {
      width:70%;
      margin: 0 auto;
      text-align: center;
   }
   input[type="button"] {
      border-radius: 10px;
   }
   .dimLight {
      background-color: #000;
   }
</style>
</head>
<body>
   <form class="dimLight" id="formSelect">
      <fieldset>
         <legend>HTML-DOM-Video-paused</legend>
         <div onclick="getTrackDetails()">
         <video id="demo" width="320" controls><source    src='http://www.tutorialspoint.com/html5/foo.mp4' type="video/mp4"></video><br>
         </div></fieldset></form>
<script>
   var formSelect = document.getElementById("formSelect");
   var demo = document.getElementById("demo");
   demo.autoplay = true;
   function getTrackDetails() {
      if(demo.paused)
         formSelect.classList.add('dimLight');
      else
         formSelect.classList.remove('dimLight');
   }
</script>
</body>
</html>

Output

Before clicking video to pause it −

After clicking video to pause it −

Updated on: 18-Feb-2021

59 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements