$(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 );
});