Media: When reusing the initial values from the global MediaElement config object, the config object should first be cloned. Objects in JS are references that will retain any changes. This fixes an issue where player controls could get mixed up between instances when multiple players (namely, single audio and audio playlists, in a certain order) are on the same page.

Props Fab1en.
Fixes #34152.


git-svn-id: https://develop.svn.wordpress.org/trunk@36364 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2016-01-20 15:46:59 +00:00
parent 65267f09fb
commit 2ed7c6d857
2 changed files with 3 additions and 3 deletions

View File

@ -20,7 +20,7 @@
*/
function initialize() {
if ( typeof _wpmejsSettings !== 'undefined' ) {
settings = _wpmejsSettings;
settings = $.extend( true, {}, _wpmejsSettings );
}
settings.success = settings.success || function (mejs) {

View File

@ -31,7 +31,7 @@
_.bindAll( this, 'bindPlayer', 'bindResetPlayer', 'setPlayer', 'ended', 'clickTrack' );
if ( ! _.isUndefined( window._wpmejsSettings ) ) {
this.settings = _wpmejsSettings;
this.settings = _.clone( _wpmejsSettings );
}
this.settings.success = this.bindPlayer;
this.setPlayer();
@ -172,4 +172,4 @@
window.WPPlaylistView = WPPlaylistView;
}(jQuery, _, Backbone));
}(jQuery, _, Backbone));