X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/256a3b381f63716209b3527d0a14442ae570c283..4713a14935b83517997f3c88f808eb41da55033d:/wp-includes/js/mediaelement/wp-mediaelement.js diff --git a/wp-includes/js/mediaelement/wp-mediaelement.js b/wp-includes/js/mediaelement/wp-mediaelement.js index 505decd0..72ea6bde 100644 --- a/wp-includes/js/mediaelement/wp-mediaelement.js +++ b/wp-includes/js/mediaelement/wp-mediaelement.js @@ -7,8 +7,22 @@ $(function () { var settings = {}; - if ( typeof _wpmejsSettings !== 'undefined' ) + if ( $( document.body ).hasClass( 'mce-content-body' ) ) { + return; + } + + if ( typeof _wpmejsSettings !== 'undefined' ) { settings.pluginPath = _wpmejsSettings.pluginPath; + } + + settings.success = function (mejs) { + var autoplay = mejs.attributes.autoplay && 'false' !== mejs.attributes.autoplay; + if ( 'flash' === mejs.pluginType && autoplay ) { + mejs.addEventListener( 'canplay', function () { + mejs.play(); + }, false ); + } + }; $('.wp-audio-shortcode, .wp-video-shortcode').mediaelementplayer( settings ); });