#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 )
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
andmediaelement-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
, andmediaelement-and-player.js
. Keepmediaelementplayer.min.css
andmediaelement-and-player.min.js
. - Do we need the legacy CSS files? If yes, remove
mediaelementplayer-legacy.css
, keepmediaelementplayer-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)
Change History (25)
#3
@
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
#5
@
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
@
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
#9
@
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.
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.