requestAnimationFrame(self.update_player_progress);
    }
  }
  if (player.duration) {
    loadedMetadata()
  } else {
    player.addEventListener("loadedmetadata", loadedMetadata);
  }
  player.onvolumechange = function() {
    if (player.hasAttribute("muted")) {
      return;
    }

    if (self.saveVolume) {
      if (!player.muted) {
        setCookie("volume", player.volume);
      }
      setCookie("muted", player.muted);
    }

    self.update_player_controls();
  };

  var activityTimeout = null;
  