]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-includes/js/mediaelement/wp-mediaelement.js
WordPress 3.9
[autoinstalls/wordpress.git] / wp-includes / js / mediaelement / wp-mediaelement.js
1 /* global mejs, _wpmejsSettings */
2 (function ($) {
3         // add mime-type aliases to MediaElement plugin support
4         mejs.plugins.silverlight[0].types.push('video/x-ms-wmv');
5         mejs.plugins.silverlight[0].types.push('audio/x-ms-wma');
6
7         $(function () {
8                 var settings = {};
9
10                 if ( $( document.body ).hasClass( 'mce-content-body' ) ) {
11                         return;
12                 }
13
14                 if ( typeof _wpmejsSettings !== 'undefined' ) {
15                         settings.pluginPath = _wpmejsSettings.pluginPath;
16                 }
17
18                 settings.success = function (mejs) {
19                         var autoplay = mejs.attributes.autoplay && 'false' !== mejs.attributes.autoplay;
20                         if ( 'flash' === mejs.pluginType && autoplay ) {
21                                 mejs.addEventListener( 'canplay', function () {
22                                         mejs.play();
23                                 }, false );
24                         }
25                 };
26
27                 $('.wp-audio-shortcode, .wp-video-shortcode').mediaelementplayer( settings );
28         });
29
30 }(jQuery));