Skip to content

Commit

Permalink
Merge pull request #188 from zen-audio-player/bugfix/pause-on-error
Browse files Browse the repository at this point in the history
Fix: pause video when we get an error
  • Loading branch information
shakeelmohamed committed Apr 17, 2016
2 parents ab2cbb6 + e474fb4 commit d1c691f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions js/everything.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -216,6 +219,12 @@ var ZenPlayer = {
$("#pause").show();
$("#play").hide();
},
play: function() {
player.playVideo();
},
pause: function() {
player.pauseVideo();
},
showPlayButton: function() {
$("#play").show();
$("#pause").hide();
Expand All @@ -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();
}
});

Expand Down

0 comments on commit d1c691f

Please sign in to comment.