Edit File by line
/home/barbar84/public_h.../wp-inclu.../js/mediaele...
File: mediaelement-migrate.js
/* global console, MediaElementPlayer, mejs */
[0] Fix | Delete
(function ( window, $ ) {
[1] Fix | Delete
// Reintegrate `plugins` since they don't exist in MEJS anymore; it won't affect anything in the player
[2] Fix | Delete
if (mejs.plugins === undefined) {
[3] Fix | Delete
mejs.plugins = {};
[4] Fix | Delete
mejs.plugins.silverlight = [];
[5] Fix | Delete
mejs.plugins.silverlight.push({
[6] Fix | Delete
types: []
[7] Fix | Delete
});
[8] Fix | Delete
}
[9] Fix | Delete
[10] Fix | Delete
// Inclusion of old `HtmlMediaElementShim` if it doesn't exist
[11] Fix | Delete
mejs.HtmlMediaElementShim = mejs.HtmlMediaElementShim || {
[12] Fix | Delete
getTypeFromFile: mejs.Utils.getTypeFromFile
[13] Fix | Delete
};
[14] Fix | Delete
[15] Fix | Delete
// Add missing global variables for backward compatibility
[16] Fix | Delete
if (mejs.MediaFeatures === undefined) {
[17] Fix | Delete
mejs.MediaFeatures = mejs.Features;
[18] Fix | Delete
}
[19] Fix | Delete
if (mejs.Utility === undefined) {
[20] Fix | Delete
mejs.Utility = mejs.Utils;
[21] Fix | Delete
}
[22] Fix | Delete
[23] Fix | Delete
/**
[24] Fix | Delete
* Create missing variables and have default `classPrefix` overridden to avoid issues.
[25] Fix | Delete
*
[26] Fix | Delete
* `media` is now a fake wrapper needed to simplify manipulation of various media types,
[27] Fix | Delete
* so in order to access the `video` or `audio` tag, use `media.originalNode` or `player.node`;
[28] Fix | Delete
* `player.container` used to be jQuery but now is a HTML element, and many elements inside
[29] Fix | Delete
* the player rely on it being a HTML now, so its conversion is difficult; however, a
[30] Fix | Delete
* `player.$container` new variable has been added to be used as jQuery object
[31] Fix | Delete
*/
[32] Fix | Delete
var init = MediaElementPlayer.prototype.init;
[33] Fix | Delete
MediaElementPlayer.prototype.init = function () {
[34] Fix | Delete
this.options.classPrefix = 'mejs-';
[35] Fix | Delete
this.$media = this.$node = $( this.node );
[36] Fix | Delete
init.call( this );
[37] Fix | Delete
};
[38] Fix | Delete
[39] Fix | Delete
var ready = MediaElementPlayer.prototype._meReady;
[40] Fix | Delete
MediaElementPlayer.prototype._meReady = function () {
[41] Fix | Delete
this.container = $( this.container) ;
[42] Fix | Delete
this.controls = $( this.controls );
[43] Fix | Delete
this.layers = $( this.layers );
[44] Fix | Delete
ready.apply( this, arguments );
[45] Fix | Delete
};
[46] Fix | Delete
[47] Fix | Delete
// Override method so certain elements can be called with jQuery
[48] Fix | Delete
MediaElementPlayer.prototype.getElement = function ( el ) {
[49] Fix | Delete
return $ !== undefined && el instanceof $ ? el[0] : el;
[50] Fix | Delete
};
[51] Fix | Delete
[52] Fix | Delete
// Add jQuery ONLY to most of custom features' arguments for backward compatibility; default features rely 100%
[53] Fix | Delete
// on the arguments being HTML elements to work properly
[54] Fix | Delete
MediaElementPlayer.prototype.buildfeatures = function ( player, controls, layers, media ) {
[55] Fix | Delete
var defaultFeatures = [
[56] Fix | Delete
'playpause',
[57] Fix | Delete
'current',
[58] Fix | Delete
'progress',
[59] Fix | Delete
'duration',
[60] Fix | Delete
'tracks',
[61] Fix | Delete
'volume',
[62] Fix | Delete
'fullscreen'
[63] Fix | Delete
];
[64] Fix | Delete
for (var i = 0, total = this.options.features.length; i < total; i++) {
[65] Fix | Delete
var feature = this.options.features[i];
[66] Fix | Delete
if (this['build' + feature]) {
[67] Fix | Delete
try {
[68] Fix | Delete
// Use jQuery for non-default features
[69] Fix | Delete
if (defaultFeatures.indexOf(feature) === -1) {
[70] Fix | Delete
this['build' + feature]( player, $(controls), $(layers), media );
[71] Fix | Delete
} else {
[72] Fix | Delete
this['build' + feature]( player, controls, layers, media );
[73] Fix | Delete
}
[74] Fix | Delete
[75] Fix | Delete
} catch (e) {
[76] Fix | Delete
console.error( 'error building ' + feature, e );
[77] Fix | Delete
}
[78] Fix | Delete
}
[79] Fix | Delete
}
[80] Fix | Delete
};
[81] Fix | Delete
[82] Fix | Delete
})( window, jQuery );
[83] Fix | Delete
[84] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function