title: pause/play video javascript doesn't work in wordpress
body: <p>I'v search a lot for a way to pause/play a video when switching tabs and i try this code but it doesn't work 
  there is no errors in the console and i can't find out what's the problem </p>
  
  <pre class="lang-js prettyprint-override"><code>var video = document.getElementById("myvideo");
  var documentTitle = document.title;
  
  var updateTitleForVideo = function(state) {
    if (state === '') {
      document.title = documentTitle;
      return;
    }
    document.title = documentTitle + '[' + state + ']';
  };
  
  video.onpause = function() {
    updateTitleForVideo('Paused');
  };
  
  video.onplay = function() {
    updateTitleForVideo('');
  }
  
  document.addEventListener('visibilitychange', function() {
    var state = document.visibilityState;
    if (!video.paused) {
      if (state === 'hidden') {
        video.pause();
        updateTitleForVideo();
      }
    }
  });
  </code></pre>