#25243 closed enhancement (fixed)
Allow more nuanced control over mediaelement.js elements
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.0 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Media | Keywords: | has-patch |
Focuses: | Cc: |
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
@
11 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.
#3
@
11 years ago
Example use case: I want this to be able to make a button that will throw videos from my site to a chromecast device, if one is available. For this, I need to be able to modify the features array in that settings variable in order to add my new button to the player control bar.
#4
@
11 years ago
- Owner set to wonderboymusic
- Resolution set to fixed
- Status changed from new to closed
In 28370:
Making the
_wpmejsSettings
array filterable, and using the whole thing instead of justpluginPath
might be a quick and easy enhancement, to at least be able to change MediaElement settings.Maybe this would be useful for adding a
success
callback in order to add analytic events. Currently, it looks like you have to deregister wp-mediaelement.js and roll your own. :-/