[wp-trac] [WordPress Trac] #42189: MediaElement.js 4.2 is not backward compatible with 2.2
WordPress Trac
noreply at wordpress.org
Wed Oct 11 23:47:01 UTC 2017
#42189: MediaElement.js 4.2 is not backward compatible with 2.2
--------------------------+-----------------------------
Reporter: bradyvercher | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Media | Version: trunk
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
It looks like a lot of work has gone into modernizing and improving the
codebase for the new version of MediaElement.js, but backward
compatibility doesn't really seem to have been a major consideration.
Here are a few issues I've run across over the past few days while trying
to prepare our themes and plugins:
ME.js has its own API for writing plugins, which is how it builds its own
UI, however the API for this changed in 4.x. This is a basic callback for
a new feature:
{{{
MediaElementPlayer.prototype.buildfeaturename = function( player,
controls, layers, media ) {
};
}}}
In MediaElement.js 2.x, `controls`, `layers`, and `media` are all jQuery
objects, but 4.x dropped the jQuery requirement, so those are now HTML
elements. Any code that expects the jQuery objects now breaks. There are
also various public properties on the `player` object that were jQuery
objects that have been replaced or removed.
All HTML classes were prefixed with `mejs-` in 2.x. The latest version
requires setting the new `classPrefix` option to `mejs-` to maintain
backward compatibility. That's fine for the core players, but as soon as
users upgrade WordPress before their theme or plugins that relied on the
old behavior, they'll have broken media players.
Various global utiliies were also renamed, which breaks compatibility in
scripts that were relying on them. For instance, `mejs.MediaFeatures` was
renamed to `mejs.Features` and `mejs.Utility` is now `mejs.Utils`.
The styles and HTML structure for players have also changed.
With all these changes, there really isn't a way to prevent issues for
users who don't upgrade their themes and plugins before WordPress.
We're prepared to handle the support burden and I generally approve of all
the improvements in the new version of MediaElement.js, but with all the
data type and API changes, it's basically a new library, so I thought I'd
raise these concerns now in case anyone else is having similar issues.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/42189>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list