2013-11-15 01:52:09 -05:00
|
|
|
/* global mejs, _wpmejsSettings */
|
2013-03-16 01:25:44 -04:00
|
|
|
(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');
|
|
|
|
|
2013-08-01 09:15:14 -04:00
|
|
|
$(function () {
|
|
|
|
var settings = {};
|
|
|
|
|
2014-03-07 00:52:14 -05:00
|
|
|
if ( typeof _wpmejsSettings !== 'undefined' ) {
|
2014-05-11 02:25:15 -04:00
|
|
|
settings = _wpmejsSettings;
|
2014-03-07 00:52:14 -05:00
|
|
|
}
|
|
|
|
|
2014-10-28 21:21:24 -04:00
|
|
|
settings.success = settings.success || function (mejs) {
|
2014-05-10 21:28:15 -04:00
|
|
|
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 () {
|
2014-03-07 00:52:14 -05:00
|
|
|
mejs.play();
|
|
|
|
}, false );
|
|
|
|
}
|
|
|
|
};
|
2013-08-01 09:15:14 -04:00
|
|
|
|
|
|
|
$('.wp-audio-shortcode, .wp-video-shortcode').mediaelementplayer( settings );
|
2013-03-16 01:25:44 -04:00
|
|
|
});
|
|
|
|
|
2013-08-01 09:15:14 -04:00
|
|
|
}(jQuery));
|