WordPress/wp-includes/js/mediaelement/wp-mediaelement.js
Scott Taylor 75d3fe3e65 Cleanup after [29179]:
* Cleanup players when the editor is hidden - window scope is unique to each frame
* Add the editor body class to each iframe sandbox
* Remove unneeded code from `wp-mediaelement.js`

See #28905.

Built from https://develop.svn.wordpress.org/trunk@29189


git-svn-id: http://core.svn.wordpress.org/trunk@28973 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-16 16:14:14 +00:00

35 lines
906 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 ( 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));