1/* global mejs, _wpmejsSettings */ 2(function( window, $ ) { 3 4 window.wp = window.wp || {}; 5 6 // add mime-type aliases to MediaElement plugin support 7 mejs.plugins.silverlight[0].types.push('video/x-ms-wmv'); 8 mejs.plugins.silverlight[0].types.push('audio/x-ms-wma'); 9 10 function wpMediaElement() { 11 var settings = {}; 12 13 /** 14 * Initialize media elements. 15 * 16 * Ensures media elements that have already been initialized won't be 17 * processed again. 18 * 19 * @since 4.4.0 20 */ 21 function initialize() { 22 if ( typeof _wpmejsSettings !== 'undefined' ) { 23 settings = $.extend( true, {}, _wpmejsSettings ); 24 } 25 26 settings.success = settings.success || function (mejs, node, instance) { 27 var autoplay, loop; 28 29 if ( 'flash' === mejs.pluginType ) { 30 autoplay = mejs.attributes.autoplay && 'false' !== mejs.attributes.autoplay; 31 loop = mejs.attributes.loop && 'false' !== mejs.attributes.loop; 32 33 autoplay && mejs.addEventListener( 'canplay', function () { 34 mejs.play(); 35 }, false ); 36 37 loop && mejs.addEventListener( 'ended', function () { 38 mejs.play(); 39 }, false ); 40 } 41 42 $(mejs).bind('resize', function() { 43 instance.globalResizeCallback(); 44 }); 45 }; 46 47 // Only initialize new media elements. 48 $( '.wp-audio-shortcode, .wp-video-shortcode, .video-block video, .audio-block audio' ) 49 .not( '.mejs-container' ) 50 .filter(function () { 51 return ! $( this ).parent().hasClass( '.mejs-mediaelement' ); 52 }) 53 .mediaelementplayer( settings ); 54 } 55 56 return { 57 initialize: initialize 58 }; 59 } 60 61 window.wp.mediaelement = new wpMediaElement(); 62 63 $( window.wp.mediaelement.initialize ); 64 65})( window, jQuery );
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.