- md5
- f0a8c15f6d0dd7da52da0c0daa462c34
- sha1
- df55aa1fd69960ac2bab871ad73bc79fae7fb6c2
- sha256
- 5bbf3d23c2d002aecb40a1f459857a41dba3c72b1689c08b367ffb97e000840d
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
/* global _wpmejsSettings */
(function( window, $ ) {
window.wp = window.wp || {};
function wpMediaElement() {
var settings = {};
/**
* Initialize media elements.
*
* Ensures media elements that have already been initialized won't be
* processed again.
*
* @since 4.4.0
*
* @returns {void}
*/
function initialize() {
if ( typeof _wpmejsSettings !== 'undefined' ) {
settings = $.extend( true, {}, _wpmejsSettings );
}
settings.classPrefix = 'mejs-';
settings.success = settings.success || function (mejs) {
var autoplay, loop;
if ( mejs.rendererName && -1 !== mejs.rendererName.indexOf( 'flash' ) ) {
autoplay = mejs.attributes.autoplay && 'false' !== mejs.attributes.autoplay;
loop = mejs.attributes.loop && 'false' !== mejs.attributes.loop;
if ( autoplay ) {
mejs.addEventListener( 'canplay', function() {
mejs.play();
}, false );
}
if ( loop ) {
mejs.addEventListener( 'ended', function() {
mejs.play();
}, false );
}
}
};
// Only initialize new media elements.
$( '.wp-audio-shortcode, .wp-video-shortcode' )
.not( '.mejs-container' )
.filter(function () {
return ! $( this ).parent().hasClass( 'mejs-mediaelement' );
})
.mediaelementplayer( settings );
}
return {
initialize: initialize
};
}
window.wp.mediaelement = new wpMediaElement();
$( window.wp.mediaelement.initialize );
})( window, jQuery );
The same content is in 2 releases, WordPress 4.9-beta1 to 4.9-beta2. See them all, or every version of this file.