diff --git a/wp-includes/js/mediaelement/wp-mediaelement.js b/wp-includes/js/mediaelement/wp-mediaelement.js
index c43c90289e..52e1bbd32f 100644
--- a/wp-includes/js/mediaelement/wp-mediaelement.js
+++ b/wp-includes/js/mediaelement/wp-mediaelement.js
@@ -19,6 +19,8 @@
* @return {void}
*/
function initialize() {
+ var selectors = [];
+
if ( typeof _wpmejsSettings !== 'undefined' ) {
settings = $.extend( true, {}, _wpmejsSettings );
}
@@ -63,8 +65,18 @@
}
};
+ if ( 'undefined' === typeof settings.videoShortcodeLibrary || 'mediaelement' === settings.videoShortcodeLibrary ) {
+ selectors.push( '.wp-video-shortcode' );
+ }
+ if ( 'undefined' === typeof settings.audioShortcodeLibrary || 'mediaelement' === settings.audioShortcodeLibrary ) {
+ selectors.push( '.wp-audio-shortcode' );
+ }
+ if ( ! selectors.length ) {
+ return;
+ }
+
// Only initialize new media elements.
- $( '.wp-audio-shortcode, .wp-video-shortcode' )
+ $( selectors.join( ', ' ) )
.not( '.mejs-container' )
.filter(function () {
return ! $( this ).parent().hasClass( 'mejs-mediaelement' );
diff --git a/wp-includes/js/mediaelement/wp-mediaelement.min.js b/wp-includes/js/mediaelement/wp-mediaelement.min.js
index 0450f43ee9..f83fbee5c8 100644
--- a/wp-includes/js/mediaelement/wp-mediaelement.min.js
+++ b/wp-includes/js/mediaelement/wp-mediaelement.min.js
@@ -1 +1 @@
-!function(e,n){e.wp=e.wp||{},e.wp.mediaelement=new function(){var e={};return{initialize:function(){(e="undefined"!=typeof _wpmejsSettings?n.extend(!0,{},_wpmejsSettings):e).classPrefix="mejs-",e.success=e.success||function(e){var n,t;e.rendererName&&-1!==e.rendererName.indexOf("flash")&&(n=e.attributes.autoplay&&"false"!==e.attributes.autoplay,t=e.attributes.loop&&"false"!==e.attributes.loop,n&&e.addEventListener("canplay",function(){e.play()},!1),t)&&e.addEventListener("ended",function(){e.play()},!1)},e.customError=function(e,n){if(-1!==e.rendererName.indexOf("flash")||-1!==e.rendererName.indexOf("flv"))return''+mejsL10n.strings["mejs.download-file"]+""},n(".wp-audio-shortcode, .wp-video-shortcode").not(".mejs-container").filter(function(){return!n(this).parent().hasClass("mejs-mediaelement")}).mediaelementplayer(e)}}},n(e.wp.mediaelement.initialize)}(window,jQuery);
\ No newline at end of file
+!function(e,n){e.wp=e.wp||{},e.wp.mediaelement=new function(){var t={};return{initialize:function(){var e=[];(t="undefined"!=typeof _wpmejsSettings?n.extend(!0,{},_wpmejsSettings):t).classPrefix="mejs-",t.success=t.success||function(e){var t,n;e.rendererName&&-1!==e.rendererName.indexOf("flash")&&(t=e.attributes.autoplay&&"false"!==e.attributes.autoplay,n=e.attributes.loop&&"false"!==e.attributes.loop,t&&e.addEventListener("canplay",function(){e.play()},!1),n)&&e.addEventListener("ended",function(){e.play()},!1)},t.customError=function(e,t){if(-1!==e.rendererName.indexOf("flash")||-1!==e.rendererName.indexOf("flv"))return''+mejsL10n.strings["mejs.download-file"]+""},void 0!==t.videoShortcodeLibrary&&"mediaelement"!==t.videoShortcodeLibrary||e.push(".wp-video-shortcode"),void 0!==t.audioShortcodeLibrary&&"mediaelement"!==t.audioShortcodeLibrary||e.push(".wp-audio-shortcode"),e.length&&n(e.join(", ")).not(".mejs-container").filter(function(){return!n(this).parent().hasClass("mejs-mediaelement")}).mediaelementplayer(t)}}},n(e.wp.mediaelement.initialize)}(window,jQuery);
\ No newline at end of file
diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php
index b430759595..359e172a7f 100644
--- a/wp-includes/script-loader.php
+++ b/wp-includes/script-loader.php
@@ -1111,6 +1111,10 @@ function wp_default_scripts( $scripts ) {
'pluginPath' => includes_url( 'js/mediaelement/', 'relative' ),
'classPrefix' => 'mejs-',
'stretching' => 'responsive',
+ /** This filter is documented in wp-includes/media.php */
+ 'audioShortcodeLibrary' => apply_filters( 'wp_audio_shortcode_library', 'mediaelement' ),
+ /** This filter is documented in wp-includes/media.php */
+ 'videoShortcodeLibrary' => apply_filters( 'wp_video_shortcode_library', 'mediaelement' ),
);
did_action( 'init' ) && $scripts->localize(
'mediaelement',
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 63c4bd9e51..b97228733c 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '6.2-alpha-55270';
+$wp_version = '6.2-alpha-55271';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.