title: Using visibility API in Angular?
body: <p>I have implemented Visibility API inside a constructor of an Angular component similar to this</p>
  
  <pre><code>constructor() {
      var hidden, state, visibilityChange;
      if (typeof document.hidden !== "undefined") {
          hidden = "hidden";
          visibilityChange = "visibilitychange";
          state = "visibilityState";
      }
  
      document.addEventListener(visibilityChange, function() {
          if(status == hidden){
              console.log("Hidden");
          }
          else if(status != hidden){
              console.log("Visible");
          }
      }, false);
  }
  
  pauseVideo(){
      //Video pause code
  }
  </code></pre>
  
  <p>I need to pause the video i.e., call the <code>pauseVideo()</code> method when the Visibility changes to hidden, How do i do it?</p>