Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 3 years ago

#42720 closed enhancement (fixed)

Remove unnecessary MediaElement.js files

Reported by: sergeybiryukov's profile SergeyBiryukov Owned by: joemcgill's profile joemcgill
Milestone: 4.9.2 Priority: normal
Severity: normal Version: 4.9
Component: Media Keywords: has-patch needs-testing
Focuses: Cc:

Description (last modified by SergeyBiryukov)

Looking at the recent MediaElement.js upgrades in [41198], [41240], [41877], its directory size has grown almost 6 times (!) from ~289 KB in 4.8.x to ~1600 KB in 4.9. I think we can remove some redundant files there.

In 4.8.x:

  • lang directory was not included, as WordPress uses its own translations.
  • Only mediaelement-and-player.js was included, and only in minified form:
    mediaelementplayer.min.css
    mediaelement-and-player.min.js
    

In 4.9:

  • lang directory is included, despite WordPress using its own translations.
  • mediaelement.js and mediaelement-and-player.js are included, both in non-minified and minified form:
    mediaelementplayer.css
    mediaelementplayer.min.css
    mediaelement-and-player.js
    mediaelement-and-player.min.js
    mediaelement.js
    mediaelement.min.js
    
  • Legacy CSS files are included, both in minified and non-minified form:
    mediaelementplayer-legacy.css
    mediaelementplayer-legacy.min.css
    
  • Five renderers are included, both in minified and non-minified form, of which only vimeo.min.js is used:
    dailymotion.js
    dailymotion.min.js
    facebook.js
    facebook.min.js
    soundcloud.js
    soundcloud.min.js
    twitch.js
    twitch.min.js
    vimeo.js
    vimeo.min.js
    

Suggestions:

  • Remove the lang directory.
  • Remove mediaelementplayer.css, mediaelement(.min).js, and mediaelement-and-player.js. Keep mediaelementplayer.min.css and mediaelement-and-player.min.js.
  • Do we need the legacy CSS files? If yes, remove mediaelementplayer-legacy.css, keep mediaelementplayer-legacy.min.css, which is the only one used anyway.
  • Do we need all the renderers? If yes, remove non-minified files, keep minified ones.

Attachments (1)

42720.diff (142.7 KB) - added by joemcgill 7 years ago.

Download all attachments as: .zip

Change History (25)

#1 @joemcgill
7 years ago

  • Keywords needs-patch added

I'm +1 on these suggestions and we should make these changes sooner rather than later so the additional files don't become dependencies of third party plugins. I'm not opposed to keeping the unminified version of mediaelement-and-player.js for debugging purposes, but don't feel strongly about keeping it either if we didn't have an unminified version previously.

As for whether or not we need any of the legacy CSS files or unused renderers, I'd be interested in feedback from @rafa8626.

#2 @SergeyBiryukov
7 years ago

  • Milestone changed from 5.0 to 4.9.2

#3 @rafa8626
7 years ago

IMO, just keep the following files (if your Grunt script minifies them), since it will be easier to deal with non-minified files, fix whatever you have to fix and then minify them:

mediaelement-and-player.js
mediaelementplayer-legacy.css
renderers/vimeo.js
wp-mediaelement.css
wp-mediaelement.js
wp-playlist.js

#4 @SergeyBiryukov
7 years ago

  • Description modified (diff)

#5 @SergeyBiryukov
7 years ago

For reference, these files also take up ~780 KB:

mediaelement-flash-audio-ogg.swf
mediaelement-flash-video-hls.swf
mediaelement-flash-video-mdash.swf

Not sure how widespread these formats are, though I guess they should all be kept.

#6 @rafa8626
7 years ago

I haven't seen WP supporting HLS or M(PEG)-DASH yet. I'd say they should go, if that's the case.

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


7 years ago

This ticket was mentioned in Slack in #core-committers by joemcgill. View the logs.


7 years ago

@joemcgill
7 years ago

#9 @joemcgill
7 years ago

  • Keywords has-patch needs-testing added; needs-patch removed
  • Owner set to joemcgill
  • Status changed from new to assigned

Finally had a moment to look into this and 42720.diff is a first pass that removes the lang directory, all the renders except for vimeo, based on @rafa8626's comment above, and removes all of the SWF files which are already depreciated upstream as MEJS no longer supports the browsers that require these fallback files in the first place.

I've elected to leave the minified files since we generally build and commit them anyway.

#10 @dd32
7 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 42462:

External Libraries: Remove unnecessary / obsoleted MediaElement.js files.

Props joemcgill.
Fixes #42720 for trunk.

#11 @dd32
7 years ago

In 42465:

External Libraries: Remove unnecessary / obsoleted MediaElement.js files.

Props joemcgill.
Merges [42462] to the 4.9 branch.
Fixes #42720 for 4.9.

#12 @dd32
7 years ago

In 42478:

External Libraries: Remove unnecessary / obsoleted MediaElement.js files.

Fixes #42720 for 4.8.

#13 @dd32
7 years ago

In 42479:

External Libraries: Remove unnecessary / obsoleted MediaElement.js files.

Merges [42478] to the 4.7 branch.
Fixes #42720 for 4.7.

#14 @dd32
7 years ago

In 42480:

External Libraries: Remove unnecessary / obsoleted MediaElement.js files.

Merges [42478] to the 4.6 branch.
Fixes #42720 for 4.6.

#15 @dd32
7 years ago

In 42481:

External Libraries: Remove unnecessary / obsoleted MediaElement.js files.

Merges [42478] to the 4.5 branch.
Fixes #42720 for 4.5.

#16 @dd32
7 years ago

In 42482:

External Libraries: Remove unnecessary / obsoleted MediaElement.js files.

Merges [42478] to the 4.4 branch.
Fixes #42720 for 4.4.

#17 @dd32
7 years ago

In 42483:

External Libraries: Remove unnecessary / obsoleted MediaElement.js files.

Merges [42478] to the 4.3 branch.
Fixes #42720 for 4.3.

#18 @dd32
7 years ago

In 42484:

External Libraries: Remove unnecessary / obsoleted MediaElement.js files.

Merges [42478] to the 4.2 branch.
Fixes #42720 for 4.2.

#19 @dd32
7 years ago

In 42485:

External Libraries: Remove unnecessary / obsoleted MediaElement.js files.

Merges [42478] to the 4.1 branch.
Fixes #42720 for 4.1.

#20 @dd32
7 years ago

In 42486:

External Libraries: Remove unnecessary / obsoleted MediaElement.js files.

Merges [42478] to the 4.0 branch.
Fixes #42720 for 4.0.

#21 @dd32
7 years ago

In 42487:

External Libraries: Remove unnecessary / obsoleted MediaElement.js files.

Merges [42478] to the 3.9 branch.
Fixes #42720 for 3.9.

#22 @dd32
7 years ago

In 42488:

External Libraries: Remove unnecessary / obsoleted MediaElement.js files.

Merges [42478] to the 3.8 branch.
Fixes #42720 for 3.8.

#23 @dd32
7 years ago

In 42489:

External Libraries: Remove unnecessary / obsoleted MediaElement.js files.

Merges [42478] to the 3.7 branch.
Fixes #42720 for 3.7.

#24 @Szyam
3 years ago

the mediaelement.legacy.min is being called into my site somehow ( podcast plugin i believe ) and the styles are interfering with other css keyframe animations. Hoping core file will be edited, maintained or removed.

Note: See TracTickets for help on using tickets.