]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/js/mediaelement/wp-mediaelement.js
WordPress 3.9
[autoinstalls/wordpress.git] / wp-includes / js / mediaelement / wp-mediaelement.js
index 505decd040fccb7a67f9d6b4da9fd3c2b54fd1c4..72ea6bde31ba57ec30d20a80c7e1e944519d3596 100644 (file)
@@ -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 );
        });