Make WordPress Core

Opened 4 years ago

Last modified 3 weeks ago

#56320 accepted defect (bug)

Update mediaelement.js to the latest version

Reported by: desrosj Owned by: adamsilverstein
Priority: normal Milestone: Future Release
Component: External Libraries Version:
Severity: normal Keywords: has-patch needs-testing 2nd-opinion
Cc: Focuses: accessibility, performance

Description

Follow up to #56319 (updating to the latest 4.x release).

The latest version of mediaelement, as of today, is ​5.0.5.

Version 5.0 made the player WCAG 2.1 compliant, but some of the changes required are breaking. It's possible this update can be merged into WordPress without issue, but this update needs to be fully tested, and there may be a developer note required to communicate action that needs to be taken by plugin and theme developers.

Change History (61)

#1 @joedolson
4 years ago

  • Focuses accessibility added

#2 @desrosj
4 years ago

  • Focuses accessibility removed

The project's Migration Guide has specific changes to make and things to check when updating to version 5.x: ​https://github.com/mediaelement/mediaelement/blob/master/MIGRATION.md#migrating-from-4x-to-5x-version.

#3 @desrosj
4 years ago

  • Focuses accessibility added

Unintentionally removed the accessibility focus. Thanks for adding that, @joedolson!

This ticket was mentioned in ​PR #3139 on ​WordPress/wordpress-develop by ​CrochetFeve0251.


4 years ago
#4

  • Keywords has-patch added; needs-patch removed

Updated mediaelement.js to 5.0.5
Trac ticket: 56320

This ticket was mentioned in ​Slack in #core-performance by westonruter. ​View the logs.


3 years ago

#6 follow-up: @westonruter
3 years ago

  • Focuses performance added

The latest version is now ​v7.0.4. Note this release includes a ​performance fix.

#7 @adamsilverstein
3 years ago

  • Milestone Future Release → 6.6
  • Owner set to adamsilverstein
  • Status new → assigned

Lets try to land this in 6.6, ideally we should commit this change soon so it gets as wide spread testing as possible.

#8 in reply to: ↑ 6 @desrosj
3 years ago

  • Keywords needs-refresh added

Replying to westonruter:

The latest version is now ​v7.0.4. Note this release includes a ​performance fix.

@coquardcyr I realize it's been nearly 2 years since you created the PR attached here, but would you be interested in refreshing it to include the current latest version for testing?

#9 @coquardcyr
3 years ago

Hey @desrosj,
Just to confirm we are talking about version 7.0.5 for the last version?

I updated the branch with that version.

#10 @desrosj
2 years ago

  • Keywords needs-testing added

The PR is looking good. I'd like to see some manual testing to confirm there's no strangeness.

This ticket was mentioned in ​Slack in #core-performance by mukeshpanchal27. ​View the logs.


2 years ago

#12 @adamsilverstein
2 years ago

Testing Instructions

mediaelement.js is used to deliver a uniform video and audio playing experience to users. originally designed for the [video] and [audio] shortcodes (and maybe playlists?), I believe it is still used when inserting video or audio from the media library in the block editor.

  1. create a new post and upload a video and audio file for testing.
  2. embed the audio and video files.
  3. view the post and test that the audio and video controls work correctly and that no errors are visible in the debugger console.
  4. verify that mediaelement.js loaded with current version

Note: mediaelement was previously updated in https://core.trac.wordpress.org/ticket/39686 which might be useful to review for possible issues to look for.

#13 @mukesh27
2 years ago

@annezazu (Test Lead for 6.6) this ticket needs some manual testing. Could you please take a look when you have moment. Thanks!

This ticket was mentioned in ​Slack in #core-test by annezazu. ​View the logs.


2 years ago

#15 @annezazu
2 years ago

Flagged it for the core-test crew for now and will test early next week. I've been out much of this week but didn't want it to sit!

#16 @adamsilverstein
2 years ago

@coquardcyr - thanks for working on this.

I gave it a test and noticed some initial issues we need to resolve.

To test this I would up uploading an mp4 video file and an mp3 audio file to my page, and embedding them using shortcodes (instead of the block editor which inserts native video and audio html elements). I did this in the code editor view in Gutenberg (screenshot incoming).

The audio player loaded and worked as expected. The video player worked and loaded, however it seemed to missing part of its UI (see screenshot). One file seems to have failed to load "mejs-controls.svg" that is likely the issue.

#17 @adamsilverstein
2 years ago

I spent a little time trying to fix the loading issue and it will need some more work. The svg is now loaded in JS so it needs some changes to make that work correctly.

Likely we will need to punt this if we can't get the issues fixed by beta 1.

#18 @adamsilverstein
2 years ago

It should be possible to pass the correct path to the Javascript using a configuration variable, see ​this comment

This ticket was mentioned in ​PR #6714 on ​WordPress/wordpress-develop by ​@adamsilverstein.


2 years ago
#19

  • Keywords needs-refresh removed

Trac ticket:

#20 @adamsilverstein
2 years ago

I was able to fix the svg loading by adding the iconPath to the passed settings, see ​this commit

After this change, the icons for the video player loaded, however the main play button that is overlaid over the video was in the corner instead of the center of the video. In addition, I noted an error in the console indicating something went wrong. I will upload some screenshots.

Last edited 2 years ago by adamsilverstein (previous) (diff)

This ticket was mentioned in ​Slack in #core-performance by adamsilverstein. ​View the logs.


2 years ago

#22 @adamsilverstein
2 years ago

  • Milestone 6.6 → 6.7

Note that in my ​PR I also tried upgrading to the latest latest version - 7.0.5.

Since I'm still see unresolved display issues with the player, I'm going to punt this to 6.7 for now.

This ticket was mentioned in ​Slack in #core-performance by mukeshpanchal27. ​View the logs.


2 years ago

#24 @adamsilverstein
2 years ago

  • Keywords 2nd-opinion added

After discussing this during a performance bug scrub, we should consider another approach.

  • Upgrading mediaelement is turning out to be a little trickier than just updating the library
  • This is *only* used for legacy [audio] and [video] shortcodes, and really only as a shim for browsers that don't support video or audio natively
  • All WordPress supported browsers now support native video and audio tags

In conclusion, I'd like to propose deprecating support for mediaelement.js and updating the shortcodes to use native HTML elements instead. Feedback welcome!

#25 @joedolson
2 years ago

We should conduct some up to date comparison testing between the accessibility of the native elements and MediaElement.js; last documentation I saw on ​native video accessibility was not favorable to the native video player, but that was five years ago, so it's probably not totally accurate anymore.

Updating shortcodes to use native HTML elements will probably visually change a lot of sites, since the HTML wrappers for mediaelement.js are common targets for style hooks. I'm not sure that's an easy path to take. Just a casual search on the .mejs-container wrapper ​shows significant use in themes.

This ticket was mentioned in ​Slack in #core-performance by mukeshpanchal27. ​View the logs.


2 years ago

#27 @pbearne
2 years ago

I like the idea of using HTML elements, but style changes might/will be an issue
we ship CSS to make the native look like the old MediaElement.js

#28 @joemcgill
2 years ago

Personally, I think it's ok to retain the MEJS library for shortcodes, but I don't think we need to prioritize upgrading the library, unless there is some real user benefit. We can also switch the shortcodes to using native with a documented way for sites that are relying on the MEJS library for styling purposes to retain its use.

If there are a11y issues with using native HTML video components, then it seems we would need to address the same issues for non-shortcode uses as well, and using the same implementation for shortcodes that we use for blocks would make this less complex to solve.

This ticket was mentioned in ​Slack in #core by hellofromtonya. ​View the logs.


2 years ago

This ticket was mentioned in ​Slack in #core-media by joedolson. ​View the logs.


2 years ago

This ticket was mentioned in ​Slack in #core-performance by mukeshpanchal27. ​View the logs.


2 years ago

#32 @adamsilverstein
2 years ago

  • Milestone 6.7 → Future Release
  • Status assigned → accepted

deprioritizing this work due to the challenge of upgrading and the plan to move to more modern solutions.

#33 @adamsilverstein
2 years ago

  • Owner adamsilverstein removed
  • Status accepted → assigned

#34 @adamsilverstein
2 years ago

  • Owner set to adamsilverstein
  • Status assigned → accepted

This ticket was mentioned in ​Slack in #core by stoyangeorgiev. ​View the logs.


2 years ago

This ticket was mentioned in ​Slack in #core by stoyangeorgiev. ​View the logs.


2 years ago

This ticket was mentioned in ​Slack in #core-performance by adamsilverstein. ​View the logs.


22 months ago

#38 @johnbillion
15 months ago

#63819 was marked as a duplicate.

This ticket was mentioned in ​Slack in #accessibility by joedolson. ​View the logs.


8 months ago

#40 @joedolson
8 months ago

  • Milestone Future Release → 7.1

I'd like to get back on this one again; milestoning for 7.1. Happy to take ownership, @adamsilverstein, if you don't think you'll have the bandwidth.

#41 @joedolson
8 months ago

  • Keywords good-first-bug removed

Removing good-first-bug; evidence does not support that!

#42 @pedrofigueroa1989
5 months ago

@adamsilverstein @desrosj:
Would you mind adding testing steps to make the changes easier to review?

#43 @afercia
5 months ago

When updating mediaelement.js please always test at least keyboard accessibility of all the UIs generated by mediaelement )video player, audio player...), test for focus losses and general operability with a keyboard. As far as I can tell, in the past we have had some unexpected accessibility regression when updating this library.

#44 @joedolson
5 months ago

I tested MediaElementJS 7.1.0 today, and it does contain at least one significant regression in accessibility - the list of captions doesn't remain visible to be navigated via the keyboard.

On the whole, it looks to me like MediaElementJS is in minimal maintenance mode - there've only been 48 commits to the package in the last 3 years.

Practically speaking, the reliability of MediaElementJS doesn't seem strong, and I'm not seeing a great benefit to updating.

This ticket was mentioned in ​Slack in #accessibility by joedolson. ​View the logs.


5 months ago

This ticket was mentioned in ​Slack in #accessibility by joedolson. ​View the logs.


4 months ago

#47 @joedolson
4 months ago

  • Milestone 7.1 → 7.2

Looking at the open PRs, I'm also seeing things like ​https://github.com/mediaelement/mediaelement/issues/3006, which makes me concerned that the latest version isn't really stable enough.

I think we should give serious consideration to forking this for internal use, so we can fix bugs - there hasn't been any significant feature development, and it's no longer part of the primary WordPress editing system.

Moving to 7.2 for further consideration.

This ticket was mentioned in ​Slack in #core-test by softglaze. ​View the logs.


3 months ago

#49 @peterwilsoncc
7 weeks ago

@joedolson In your testing during the 7.1 release cycle, did you find anything the library supports that the native media elements in browsers do not?

My recollection is that MediaElement.js was added to WP back in the days that the browser elements were lacking support.

In wp_video_shortcode() I can see some code to support YouTube and Vimeo (which ME.js) supports but backward compatibility there is a solvable problem via the embed component.

#50 @westonruter
7 weeks ago

I think the main benefit of ME.js now how the player can be skinned with CSS in various ways prior to the era of "CSS Shadow Parts". So I think it's mainly a back-compat concern for not breaking sites with their custom player skins.

Note the ecosystem CSS that targets ME.js:

Plugins: ​https://veloria.dev/search/acffc2aa-0228-4dad-bd25-1a311d4ff2ec
Themes: ​https://veloria.dev/search/4deb7691-03f5-43da-af2c-6a407f57a9a8

#51 @peterwilsoncc
7 weeks ago

Thanks Weston, I thought that had changed over the years but, alas, no.

#52 @joedolson
7 weeks ago

I'd say both were true - at the time, MediaElementJS was needed in order to have cross-browser support for media players in general, but also provided a common baseline CSS.

The former is less true, but the latter is still just as true as it ever was.

The current state of MediaElementJS 7.1 is, in my opinion, worse than using a native player on most browsers, though still better than Safari. It includes support for chapters, which are not generally available in native players, but the interface is sufficiently poor that it comes with some significant accessibility downsides.

The main benefit to using any wrapper is that it provides a common baseline for features and styling, which greatly increases consistency.

As I see the problem now, we have a media player with a strong back compatibility need due to extensive historic use, but which doesn't have a great user experience.

I'm starting to think that what we actually need to do is write a new thin client player that uses the same HTML & CSS base as MEJS, but which is mostly just a wrapper for the Audio APIs which can be more easily maintained internally. We'd probably still need to incorporate caption support, to avoid a feature regression.

#54 @adamsilverstein
5 weeks ago

I'm starting to think that what we actually need to do is write a new thin client player that uses the same HTML & CSS base as MEJS, but which is mostly just a wrapper for the Audio APIs which can be more easily maintained internally. We'd probably still need to incorporate caption support, to avoid a feature regression.

Good idea! I wonder if someone has already done this in a way we can leverage.

#55 @joedolson
4 weeks ago

I did a brief amount of research, and I don't think that somebody else's implementation is going to work. Most people doing this have the opposite need we do - they want the features, but want to replace the design. So the few cases I found of peopl edoing any customization of MediaElement had completely redone the CSS portions. E.g. ​https://onedesigns.com/freebies/custom-mediaelement-js-skin/ or ​https://github.com/justintadlock/theme-mediaelement.

#56 @adamsilverstein
3 weeks ago

  • Milestone 7.2 → Future Release

Based on the discussion above, I'm going to milestone this "Future release" as we consider the best option - my inclination would be to focus on native player support and maybe some customization options, but deprecate media element support rather than trying to upgrade it.

Note: See TracTickets for help on using tickets.