#25243 closed enhancement (fixed)
Allow more nuanced control over mediaelement.js elements
| Reported by: | ericlewis | Owned by: | wonderboymusic |
|---|---|---|---|
| Priority: | normal | Milestone: | 4.0 |
| Component: | Media | Version: | |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
Description
The mediaelement.js implementation in 3.6 is totally rad. However, I've come across an issue.
There's not much nuanced control you have in media elements. All settings are initialized globally for all media element instances, and taking the mediaelement.js defaults, without giving developers an option to override the settings.
wp_editor() is a good model of element instances, and allowing control over each of these instances. I'd like to suggest breaking out separate element instances in this fashion, so settings can be applied to each element independently, and open up these options to end-users through the shortcode options.
Attachments (1)
Change History (7)
#2
@
12 years ago
- Keywords has-patch added; needs-patch removed
A very simple patch would be simply to eliminate the "pluginPath" part of the wp-mediaelement.js file. This allows code to use the existing functions to pass new settings parameters to the mediaelementjs code.
25243.diff shows the simplest change that works. Using this, one could call wp_localize_script like so to give it new parameters:
wp_localize_script( 'wp-mediaelement', '_wpmejsSettings', array( 'pluginPath' => includes_url( 'js/mediaelement/', 'relative' ), 'features' => array( 'whatever' ), )
A filter to change these parameters would be preferable so that multiple plugins don't step on each other here. But this change would be needed anyway to allow other parameters than just pluginPath to be passed to the JS.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Making the
_wpmejsSettingsarray filterable, and using the whole thing instead of justpluginPathmight be a quick and easy enhancement, to at least be able to change MediaElement settings.Maybe this would be useful for adding a
successcallback in order to add analytic events. Currently, it looks like you have to deregister wp-mediaelement.js and roll your own. :-/