]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/js/mediaelement/wp-mediaelement.js
WordPress 4.3
[autoinstalls/wordpress.git] / wp-includes / js / mediaelement / wp-mediaelement.js
index 505decd040fccb7a67f9d6b4da9fd3c2b54fd1c4..8c4364aa329a23bcccd9a38c992490f80ff3b09d 100644 (file)
@@ -7,8 +7,26 @@
        $(function () {
                var settings = {};
 
-               if ( typeof _wpmejsSettings !== 'undefined' )
-                       settings.pluginPath = _wpmejsSettings.pluginPath;
+               if ( typeof _wpmejsSettings !== 'undefined' ) {
+                       settings = _wpmejsSettings;
+               }
+
+               settings.success = settings.success || function (mejs) {
+                       var autoplay, loop;
+
+                       if ( 'flash' === mejs.pluginType ) {
+                               autoplay = mejs.attributes.autoplay && 'false' !== mejs.attributes.autoplay;
+                               loop = mejs.attributes.loop && 'false' !== mejs.attributes.loop;
+
+                               autoplay && mejs.addEventListener( 'canplay', function () {
+                                       mejs.play();
+                               }, false );
+
+                               loop && mejs.addEventListener( 'ended', function () {
+                                       mejs.play();
+                               }, false );
+                       }
+               };
 
                $('.wp-audio-shortcode, .wp-video-shortcode').mediaelementplayer( settings );
        });