From e474fb48ab510a796f269d1e45a5287c19418fe1 Mon Sep 17 00:00:00 2001 From: Shakeel Mohamed Date: Sat, 16 Apr 2016 23:42:18 -0700 Subject: [PATCH] Fix: pause video when we get an error This needs to happen since we hide the controls. --- js/everything.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/js/everything.js b/js/everything.js index 1e27a79e..f912deb1 100644 --- a/js/everything.js +++ b/js/everything.js @@ -146,6 +146,9 @@ var errorMessage = { $("#zen-video-error").text("ERROR: " + message); $("#zen-video-error").show(); + // Pause if we got an error + ZenPlayer.pause(); + // When the error message is shown, also hide the player ZenPlayer.hide(); @@ -216,6 +219,12 @@ var ZenPlayer = { $("#pause").show(); $("#play").hide(); }, + play: function() { + player.playVideo(); + }, + pause: function() { + player.pauseVideo(); + }, showPlayButton: function() { $("#play").show(); $("#pause").hide(); @@ -239,15 +248,16 @@ var ZenPlayer = { }); }, setupMediaControls: function() { + var that = this; // play/pause button click event $("#playPause").click(function(event) { event.preventDefault(); if ($("#play").is(":visible")) { - player.playVideo(); + that.play(); } else { - player.pauseVideo(); + that.pause(); } });