wp/wp-includes/js/mediaelement/wp-mediaelement.js
changeset 5 5e2f62d02dcd
parent 0 d970ebf37754
child 7 cf61fcea0001
equal deleted inserted replaced
4:346c88efed21 5:5e2f62d02dcd
       
     1 /* global mejs, _wpmejsSettings */
     1 (function ($) {
     2 (function ($) {
     2 	// add mime-type aliases to MediaElement plugin support
     3 	// add mime-type aliases to MediaElement plugin support
     3 	mejs.plugins.silverlight[0].types.push('video/x-ms-wmv');
     4 	mejs.plugins.silverlight[0].types.push('video/x-ms-wmv');
     4 	mejs.plugins.silverlight[0].types.push('audio/x-ms-wma');
     5 	mejs.plugins.silverlight[0].types.push('audio/x-ms-wma');
     5 
     6 
     6 	$(function () {
     7 	$(function () {
     7 		var settings = {};
     8 		var settings = {};
     8 
     9 
     9 		if ( typeof _wpmejsSettings !== 'undefined' )
    10 		if ( typeof _wpmejsSettings !== 'undefined' ) {
    10 			settings.pluginPath = _wpmejsSettings.pluginPath;
    11 			settings = _wpmejsSettings;
       
    12 		}
       
    13 
       
    14 		settings.success = settings.success || function (mejs) {
       
    15 			var autoplay, loop;
       
    16 
       
    17 			if ( 'flash' === mejs.pluginType ) {
       
    18 				autoplay = mejs.attributes.autoplay && 'false' !== mejs.attributes.autoplay;
       
    19 				loop = mejs.attributes.loop && 'false' !== mejs.attributes.loop;
       
    20 
       
    21 				autoplay && mejs.addEventListener( 'canplay', function () {
       
    22 					mejs.play();
       
    23 				}, false );
       
    24 
       
    25 				loop && mejs.addEventListener( 'ended', function () {
       
    26 					mejs.play();
       
    27 				}, false );
       
    28 			}
       
    29 		};
    11 
    30 
    12 		$('.wp-audio-shortcode, .wp-video-shortcode').mediaelementplayer( settings );
    31 		$('.wp-audio-shortcode, .wp-video-shortcode').mediaelementplayer( settings );
    13 	});
    32 	});
    14 
    33 
    15 }(jQuery));
    34 }(jQuery));