Pass pluginPath to MediaElement.js, fixing playback when ME.js is served through load-scripts.php.

props ocean90, wonderboymusic, azaozz.
fixes #24902.



git-svn-id: http://core.svn.wordpress.org/trunk@24940 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2013-08-01 13:15:14 +00:00
parent 1d05ebdd86
commit f590791d93
3 changed files with 14 additions and 5 deletions

View File

@ -3,8 +3,13 @@
mejs.plugins.silverlight[0].types.push('video/x-ms-wmv');
mejs.plugins.silverlight[0].types.push('audio/x-ms-wma');
$(function () {
$('.wp-audio-shortcode, .wp-video-shortcode').mediaelementplayer();
$(function () {
var settings = {};
if ( typeof _wpmejsSettings !== 'undefined' )
settings.pluginPath = _wpmejsSettings.pluginPath;
$('.wp-audio-shortcode, .wp-video-shortcode').mediaelementplayer( settings );
});
}(jQuery));
}(jQuery));

View File

@ -2020,10 +2020,11 @@ function get_admin_url( $blog_id = null, $path = '', $scheme = 'admin' ) {
* @since 2.6.0
*
* @param string $path Optional. Path relative to the includes url.
* @param string $scheme Optional. Scheme to give the includes url context.
* @return string Includes url link with optional path appended.
*/
function includes_url($path = '') {
$url = site_url() . '/' . WPINC . '/';
function includes_url( $path = '', $scheme = null ) {
$url = site_url( '/' . WPINC . '/', $scheme );
if ( $path && is_string( $path ) )
$url .= ltrim($path, '/');

View File

@ -302,6 +302,9 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'wp-mediaelement', "/wp-includes/js/mediaelement/wp-mediaelement.js", array('mediaelement'), false, 1 );
did_action( 'init' ) && $scripts->localize( 'wp-mediaelement', '_wpmejsSettings', array(
'pluginPath' => includes_url( 'js/mediaelement/', 'relative' ),
) );
$scripts->add( 'password-strength-meter', "/wp-admin/js/password-strength-meter$suffix.js", array('jquery'), false, 1 );
did_action( 'init' ) && $scripts->localize( 'password-strength-meter', 'pwsL10n', array(