From aa12b6a228bc49e01812cd6e82d7e906818872d9 Mon Sep 17 00:00:00 2001 From: ansuz Date: Mon, 28 Sep 2020 18:22:11 +0530 Subject: [PATCH] pause active media when closing the media-tag preview modal --- www/common/inner/common-mediatag.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/www/common/inner/common-mediatag.js b/www/common/inner/common-mediatag.js index 0fc35c1c3..3d28d126a 100644 --- a/www/common/inner/common-mediatag.js +++ b/www/common/inner/common-mediatag.js @@ -231,6 +231,7 @@ define([ ]), h('div.cp-mediatag-control', right = h('span.fa.fa-chevron-right')), ]); + var $close = $modal.find('.cp-modal-close'); var $left = $(left); var $right = $(right); var $inner = $container.find('.cp-mediatag-container'); @@ -330,6 +331,13 @@ define([ $modal.on('keydown', function (e) { e.stopPropagation(); }); + + var close = function () { + $inner.find('audio, video').trigger('pause'); + $modal.hide(); + }; + + $close.on('click', close); $modal.on('keyup', function (e) { //if (!Slide.shown) { return; } e.stopPropagation(); @@ -347,7 +355,7 @@ define([ next(); break; case 27: // esc - $modal.hide(); + close(); break; default: }