diff --git a/wp-includes/js/mediaelement/wp-mediaelement.js b/wp-includes/js/mediaelement/wp-mediaelement.js index 058213065a..eb95b3d21e 100644 --- a/wp-includes/js/mediaelement/wp-mediaelement.js +++ b/wp-includes/js/mediaelement/wp-mediaelement.js @@ -1,4 +1,4 @@ -/* global _wpmejsSettings */ +/* global _wpmejsSettings, mejsL10n */ (function( window, $ ) { window.wp = window.wp || {}; @@ -42,6 +42,25 @@ } }; + /** + * Custom error handler. + * + * Sets up a custom error handler in case a video render fails, and provides a download + * link as the fallback. + * + * @since 4.9.3 + * + * @param {object} media The wrapper that mimics all the native events/properties/methods for all renderers. + * @param {object} node The original HTML video, audio, or iframe tag where the media was loaded. + * @returns {string} + */ + settings.customError = function ( media, node ) { + // Make sure we only fall back to a download link for flash files. + if ( -1 !== media.rendererName.indexOf( 'flash' ) || -1 !== media.rendererName.indexOf( 'flv' ) ) { + return '' + mejsL10n.strings['mejs.download-video'] + ''; + } + }; + // Only initialize new media elements. $( '.wp-audio-shortcode, .wp-video-shortcode' ) .not( '.mejs-container' ) diff --git a/wp-includes/js/mediaelement/wp-mediaelement.min.js b/wp-includes/js/mediaelement/wp-mediaelement.min.js index 660f89cdf3..fa5accb58f 100644 --- a/wp-includes/js/mediaelement/wp-mediaelement.min.js +++ b/wp-includes/js/mediaelement/wp-mediaelement.min.js @@ -1 +1 @@ -!function(a,b){function c(){function a(){"undefined"!=typeof _wpmejsSettings&&(c=b.extend(!0,{},_wpmejsSettings)),c.classPrefix="mejs-",c.success=c.success||function(a){var b,c;a.rendererName&&-1!==a.rendererName.indexOf("flash")&&(b=a.attributes.autoplay&&"false"!==a.attributes.autoplay,c=a.attributes.loop&&"false"!==a.attributes.loop,b&&a.addEventListener("canplay",function(){a.play()},!1),c&&a.addEventListener("ended",function(){a.play()},!1))},b(".wp-audio-shortcode, .wp-video-shortcode").not(".mejs-container").filter(function(){return!b(this).parent().hasClass("mejs-mediaelement")}).mediaelementplayer(c)}var c={};return{initialize:a}}a.wp=a.wp||{},a.wp.mediaelement=new c,b(a.wp.mediaelement.initialize)}(window,jQuery); \ No newline at end of file +!function(a,b){function c(){function a(){"undefined"!=typeof _wpmejsSettings&&(c=b.extend(!0,{},_wpmejsSettings)),c.classPrefix="mejs-",c.success=c.success||function(a){var b,c;a.rendererName&&-1!==a.rendererName.indexOf("flash")&&(b=a.attributes.autoplay&&"false"!==a.attributes.autoplay,c=a.attributes.loop&&"false"!==a.attributes.loop,b&&a.addEventListener("canplay",function(){a.play()},!1),c&&a.addEventListener("ended",function(){a.play()},!1))},c.customError=function(a,b){if(-1!==a.rendererName.indexOf("flash")||-1!==a.rendererName.indexOf("flv"))return''+mejsL10n.strings["mejs.download-video"]+""},b(".wp-audio-shortcode, .wp-video-shortcode").not(".mejs-container").filter(function(){return!b(this).parent().hasClass("mejs-mediaelement")}).mediaelementplayer(c)}var c={};return{initialize:a}}a.wp=a.wp||{},a.wp.mediaelement=new c,b(a.wp.mediaelement.initialize)}(window,jQuery); \ No newline at end of file diff --git a/wp-includes/version.php b/wp-includes/version.php index e7c9cb520b..467765a4ff 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.9.3-alpha-42580'; +$wp_version = '4.9.3-alpha-42583'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.