From de258c87e6d717bf4a13f283aa676504160bd753 Mon Sep 17 00:00:00 2001 From: Anthony Burchell Date: Mon, 8 Feb 2021 21:42:43 +0000 Subject: [PATCH] Media: Pause any playing media when closing the the media modal. Previously, any video or audio playing in the media modal failed to stop playing when the modal was closed. Now we pause the player when the modal is closed. Props adamsilverstein, hellofromTonya, paaljoachim, Mista-Flo, Clorith, justinahinon, afercia, amolv. Fixes #48562. git-svn-id: https://develop.svn.wordpress.org/trunk@50256 602fd350-edb4-49c9-b593-d223f7449a82 --- src/js/media/views/modal.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/js/media/views/modal.js b/src/js/media/views/modal.js index f7afb014b9..3804b18feb 100644 --- a/src/js/media/views/modal.js +++ b/src/js/media/views/modal.js @@ -132,6 +132,9 @@ Modal = wp.media.View.extend(/** @lends wp.media.view.Modal.prototype */{ return this; } + // Pause current audio/video even after closing the modal + $( '.mejs-pause button' ).click(); + // Enable page scrolling. $( 'body' ).removeClass( 'modal-open' );