[wp-trac] [WordPress Trac] #42189: MediaElement.js 4.2 is not backward compatible with 2.2

WordPress Trac noreply at wordpress.org
Thu Oct 12 06:40:35 UTC 2017


#42189: MediaElement.js 4.2 is not backward compatible with 2.2
--------------------------+-----------------------
 Reporter:  bradyvercher  |       Owner:  rafa8626
     Type:  defect (bug)  |      Status:  assigned
 Priority:  normal        |   Milestone:  4.9
Component:  Media         |     Version:  trunk
 Severity:  major         |  Resolution:
 Keywords:                |     Focuses:
--------------------------+-----------------------

Comment (by bradyvercher):

 @rafa8626 I haven't had a chance to test your last commit, but I'm not
 sure proxying the feature build method in `wp-mediaelement.js` will work
 because themes and plugins don't use that file when initializing their own
 players. It would really have to be part of `mediaelement-and-
 player.min.js` unless WordPress forced the compatibility layer to load
 instead of relying on themes and plugins to enqueue it.

 I'd have to dig in again, but these are some of the issues I've noticed
 based on the commits I've made over the past week or so:

 '''New Default Class Prefix'''

 Themes and plugins that initialize their own players won't have the new
 `classPrefix` option, so users that upgrade WordPress will have the new
 HTML class prefix applied to their players instead.

 '''Changed or Missing Properties'''

 The `player` instance throughout had these properties that were changed or
 are now missing:

 * `player.container` (was a jQuery collection, now an HTML element)
 * `player.controls` (was a jQuery collection, now an HTML element)
 * `player.$node` (missing)
 * `player.$media` (missing)

 '''Removed Features'''

 We used the same method core was using to add support for WMA files using
 the Silverlight plugin. Although that's been dropped, users running the
 older version of a theme or plugin will get a JavaScript error since these
 properties no longer exist.

 `mejs.plugins.silverlight[0].types.push( 'audio/x-ms-wma' );`

 Making it so that doesn't throw an error would be ideal.

 '''Changed Reference'''

 In success and feature callbacks, I believe the `media` parameter was the
 actual HTML media element ( `<audio>` or `<video>` ), whereas now it's a
 custom `<mediaelement>` wrapper, which doesn't have the same attributes
 and events.

 We kinda pushed MediaElement.js to its limits and worked around a bunch of
 issues by proxying various public methods, so we'll have to live with some
 of the issues, but all of the above were changes to public data types and
 APIs that will cause JS errors for users when upgrading WordPress. We also
 had to make numerous CSS tweaks, but those shouldn't make pages unusable
 due to errors.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/42189#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list