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
This commit is contained in:
Anthony Burchell 2021-02-08 21:42:43 +00:00
parent df0c776d1f
commit de258c87e6

View File

@ -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' );