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