mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-03 01:09:39 +01:00
aeadf0c7cf
Props Otto42 for the initial patch. Fixes #25243. Built from https://develop.svn.wordpress.org/trunk@28370 git-svn-id: http://core.svn.wordpress.org/trunk@28198 1a063a9b-81f0-0310-95a4-ce76da25c4cd
39 lines
983 B
JavaScript
39 lines
983 B
JavaScript
/* global mejs, _wpmejsSettings */
|
|
(function ($) {
|
|
// add mime-type aliases to MediaElement plugin support
|
|
mejs.plugins.silverlight[0].types.push('video/x-ms-wmv');
|
|
mejs.plugins.silverlight[0].types.push('audio/x-ms-wma');
|
|
|
|
$(function () {
|
|
var settings = {};
|
|
|
|
if ( $( document.body ).hasClass( 'mce-content-body' ) ) {
|
|
return;
|
|
}
|
|
|
|
if ( typeof _wpmejsSettings !== 'undefined' ) {
|
|
settings = _wpmejsSettings;
|
|
}
|
|
|
|
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 );
|
|
});
|
|
|
|
}(jQuery));
|