Opened 11 years ago
Last modified 6 years ago
#28619 new enhancement
Add more filters to tune audio and video shortcode library
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.9.1 |
Component: | Media | Keywords: | needs-patch |
Focuses: | Cc: |
Description
wp_video_shortcode_library
and wp_audio_shortcode_library
allow a plugin author to replace the default mediaelement.js library by another Audio/Video js library. But then, possibilities to modify the html rendering are very limited.
I have identified 2 points where a filter/action is needed :
- L1782 in wp-includes/media.php (https://github.com/WordPress/WordPress/blob/3.9.1/wp-includes/media.php#L1792)
$html = ''; if ( 'mediaelement' === $library && 1 === $instances ) $html .= "<!--[if lt IE 9]><script>document.createElement('video');</script><![endif]-->\n";
- L1820 in wp-includes/media.php (https://github.com/WordPress/WordPress/blob/3.9.1/wp-includes/media.php#L1820)
if ( 'mediaelement' === $library ) $html .= wp_mediaelement_fallback( $fileurl );
Plugin author should be able to add arbitrary HTML code before and inside the <video>
tag as easily as this is done for mediaelement.
This could be done by replacing the previous lines with an filter call, and doing the mediaelement stuff inside the filter callback that can be unregistered and replaced by plugins.
Attachments (4)
Change History (9)
#1
@
11 years ago
New hooks need to be documented as per the Inline Documentation Standards.
#2
follow-up:
↓ 3
@
11 years ago
OK, sorry. I thought we would discuss this a bit before adding docs.
Inline docs added for filters in 28619.2.patch
#3
in reply to:
↑ 2
@
11 years ago
Replying to Fab1en:
OK, sorry. I thought we would discuss this a bit before adding docs.
Inline docs added for filters in 28619.2.patch
Hi @Fab1en, thanks for the patch. In many cases docs do get added at the end of the development cycle for new hooks, though in this case I think they really serve to help explain what's being proposed. :)
Your hook docs actually look pretty great. Probably the only things I would change would be the short descriptions. Our suggested language for filters is "Filter X" or "Filters X". So in this case, rather than using, "Adds HTML before the X", maybe it would be better as something like "Filter HTML prepended to the audio shortcode output." or similar. Make sense?
Also, if you pass the --no-prefix
flag when generating your patches, it won't attach all of your personal information at the top of the patch :-).
#4
@
11 years ago
OK, thanks for the explanation. The --no-prefix
flag does not work on my git version (1.9.1
) nor is it mentioned in the git-scm doc, so I removed the personal info manually.
28619.4.patch modifies the filters inline documentation. It also adds another filter to allow plugins author to support more external video providers (instead of just YouTube).
Add filters for audio and video shortcodes