开发者 |
LewisCowles
daronspence |
---|---|
更新时间 | 2022年7月5日 16:55 |
PHP版本: | 7.2 及以上 |
WordPress版本: | 6.0 |
版权: | GPL-3.0 |
版权网址: | 版权信息 |
media-playback-speed-generate-controls
provides a single argument which is a boolean. If you return this as false, this will stop buttons being added to a media player. This is intended for advanced setups where markup for controls might be placed manually elsewhere on the page such as a sticky footer. So long as controls follow the built-in markup (being within the body tag and have a playback-rate-button class (no default styling, used for enabling DOM access only).rate
, title
and label
entries, which set the playback rate, the title and aria-title for the buttons as well as adjust the button text..playback-rate-button.mejs-active
and/or .playback-rate-button.active-playback-rate
CSS-selectors allow you to style the active speed (per-player).
Initially mejs-active class was added in order to create media-playback-js compatible / familiar class names.
Now that Gutenberg does not add these, it makes sense to for-now add two sets of classes.
The .playback-rate-button.mejs-active
selector will be deprecated in version 2.
Troubleshooting
This works with the traditional audio
, video
and playlist
shortcodes so long as WordPress uses the JavaScript player.
With the latest 1.1.1 release this also works for HTML5 audio and video too, however you will need to implement your own controls which have the playback-rate-button
class and follow the patterns of this.
HTML5 raw controls do not have a playlist the author is aware of, and they use global state, so playback rate is per-page.
There is currently no history as part of this plugin, however a sister plugin could be authored and hooks added to it to store playback rate.
Please ensure that you have no broken javascript, or wrap all functions in (function() { // do things })()
blocks to ensure nothing interferes with this plugin. This plugin does this so that it should not interfere with your site, even in browsers and pages which do not support this plugin.
Feedback
Please feel free to suggest improvements, report conflicts, and/or make suggestions for integration hooks etc.