WordPress.org

Make WordPress Core

Opened 14 months ago

Closed 12 months ago

Last modified 12 months ago

#42720 closed enhancement (fixed)

Remove unnecessary MediaElement.js files

Reported by: SergeyBiryukov Owned by: 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 13 months ago.

Download all attachments as: .zip

Change History (24)

#1 @joemcgill
14 months 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
14 months ago

  • Milestone changed from 5.0 to 4.9.2

#3 @rafa8626
14 months 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
14 months ago

  • Description modified (diff)

#5 @SergeyBiryukov
14 months 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
14 months 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.


13 months ago

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


13 months ago

@joemcgill
13 months ago

#9 @joemcgill
13 months 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
12 months 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
12 months 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
12 months ago

In 42478:

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

Fixes #42720 for 4.8.

#13 @dd32
12 months 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
12 months 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
12 months 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
12 months 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
12 months 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
12 months 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
12 months 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
12 months 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
12 months 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
12 months 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
12 months ago

In 42489:

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

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

Note: See TracTickets for help on using tickets.