assets/scripts.js: Pause and unpause on click

- By placing the event handler on the video element, we ensure we don't
  receive it when a choice item was clicked.

- Use preventDefault to avoid the pause-and-immediately-unpause
  problem due to the video element itself also handling the event.
This commit is contained in:
Vladimir Panteleev 2019-07-28 04:40:17 +00:00
parent 7989e92f2b
commit 336a65f31a

View file

@ -398,12 +398,9 @@ window.onload = function() {
var c = document.getElementById("c");
c.ondblclick = toggleFullScreen;
c.onclick = function () {
// can't togglePlayPause here, choice buttons stop the video
// should use preventdefault or something
// use spacebar for now
// mind that autoplay is disabled in latest chrome, so play after click
document.getElementById("video").play();
video_selector.onclick = function (e) {
togglePlayPause();
e.preventDefault();
};
document.onkeypress = function (e) {