src/plugin.js
function handleVisibilityChange() {
  if (document[hidden]) {
    let gifPlayers = document.querySelectorAll('.vjs-gifplayer');

    for (let gifPlayer of gifPlayers) {
      let player = gifPlayer.player;

      if (player) {
        player.pause();
      }
    }
  } else {
    autoPlayGifs();
  }
}
function handleVisibilityChange() {
  if (document[hidden]) {
    let gifPlayers = document.querySelectorAll('.vjs-gifplayer');

    for (let gifPlayer of gifPlayers) {
      let player = gifPlayer.player;

      if (player) {
        player.pause();
      }
    }
  } else {
    autoPlayGifs();
  }
}
function handleVisibilityChange ( ) { if ( document [ hidden ] ) { let gifPlayers = document . querySelectorAll ( '.vjs-gifplayer' ) ; for ( let gifPlayer of gifPlayers ) { let player = gifPlayer . player ; if ( player ) { player . pause ( ) ; } } } else { autoPlayGifs ( ) ; } }
If the page is hidden, pause the video; if the page is shown, play the video
If the page is hidden pause the video ; if the page is shown play the video