Enhance your video and audio blocks with custom web components from Media Chrome.
Media Chrome for Media Blocks brings the power of Media Chrome to WordPress media blocks. It enhances built-in video and audio blocks with custom web components, improving player controls, accessibility, and user experience. No setup required — just activate the plugin to enhance media blocks with better controls, improved accessibility, and a modernized playback experience.
(*) Spotify support is disabled by default due to its limited customization options and UI. To enable it, see the Spotify section below.
- PHP 7.4+
- WordPress 6.4
- Download the plugin ZIP file from the GitHub repository.
- Go to Plugins > Add New > Upload Plugin in your WordPress admin area.
- Upload the ZIP file and click Install Now.
- Activate the plugin.
To include this plugin as a dependency in your Composer-managed WordPress project:
- Add the plugin to your project using the following command:
composer require s3rgiosan/wp-media-chrome
- Run
composer install
to install the plugin. - Activate the plugin from your WordPress admin area or using WP-CLI.
Once activated, the plugin automatically enhances supported media blocks. Customization is optional but available via the block editor settings or theme.json
.
To customize a media player:
- Insert a supported media block
- Select the block to reveal its settings in the block editor sidebar
- Open the Media Chrome settings panel in the sidebar to enable or disable autoplay, playback speed adjustments, or fullscreen mode.
What options users see in the editor.
UI settings control which customization options appear in the block editor. They do not affect the media player's behavior on the frontend — only what users can modify.
By default, all customization options are enabled.
To limit available options, add the following to your theme.json
(example shows all options enabled for the video embed block):
{
"$schema": "https://schemas.wp.org/wp/6.5/theme.json",
"version": 2,
"settings": {
"custom": {
"mediaChrome": {
"ui": {
"embed": {
"video": {
"muted": true,
"controls": true,
"playsInline": true,
"preload": true,
"poster": true,
"autohide": true,
"playButton": true,
"seekBackwardButton": true,
"seekForwardButton": true,
"muteButton": true,
"volumeRange": true,
"timeDisplay": true,
"timeRange": true,
"playbackRateButton": true,
"fullscreenButton": true,
"airplayButton": true
}
}
}
}
}
}
}
What default values are used when no user preference is set.
Preset settings define default values for media player options when no user preference is set. If a user customizes a setting in the block editor, that value takes precedence. If no preset is set in theme.json
, the plugin uses built-in defaults (listed in Options).
Example video embed preset configuration for your theme.json
:
{
"$schema": "https://schemas.wp.org/wp/6.5/theme.json",
"version": 2,
"settings": {
"custom": {
"mediaChrome": {
"presets": {
"embed": {
"video": {
"autohide": 2,
"muted": false,
"controls": true,
"playsInline": false,
"preload": "metadata",
"poster": "",
"playButton": true,
"seekBackwardButton": true,
"seekForwardButton": true,
"muteButton": true,
"volumeRange": true,
"timeDisplay": true,
"timeRange": true,
"playbackRateButton": true,
"fullscreenButton": true,
"airplayButton": false
}
}
}
}
}
}
}
Number of seconds after which controls auto-hide when inactive. Set to -1
to disable auto-hide.
Default: 2
Determines if media starts muted.
Default: false
Toggles the display of media controls.
Default: true
When enabled, videos play inline on mobile devices rather than opening in fullscreen. Only available for embed video blocks.
Default: false
Defines the content that is preloaded. Options include 'auto'
, 'metadata'
, and 'none'
.
Default: 'metadata'
URL for the poster image displayed before playback starts. Only available for embed video blocks.
Default: ''
Whether to display the play/pause button in the control bar.
Default: true
Whether to display the button for seeking backward.
Default: true
Whether to display the button for seeking forward.
Default: true
Whether to display the mute/unmute button. Only available for video blocks.
Default: true
Whether to show the volume slider. Only available for video blocks.
Default: true
Whether to show the current time and duration of the media.
Default: true
Whether to display the timeline or progress bar.
Default: true
Whether to include a control for adjusting playback speed. Only available for video blocks.
Default: true
Whether to display the fullscreen toggle button. Only available for video blocks.
Default: true
Whether to display the AirPlay button (only supported in Safari). Only available for video blocks.
Default: false
Spotify support is disabled by default. To enable it, add the following:
PHP (functions.php
or a custom plugin)
add_filter( 'media_chrome_providers_audio', function ( $providers ) {
$providers[] = S3S\WP\MediaChrome\Provider\Spotify::class;
return $providers;
});
JavaScript (theme JavaScript file or a custom plugin)
addFilter('mediaChrome.providers.audio', 'my-plugin/enable-spotify', (providers) => {
return [...providers, 'spotify'];
});
Media Chrome components can be fully styled with CSS to match your site's design. For complete styling documentation, see the Media Chrome styling documentation.
Example of basic styling customization:
/* Change the color of the media controls */
media-control-bar {
--media-control-background: rgba(0, 0, 0, 0.7);
--media-control-hover-background: rgba(0, 0, 0, 0.9);
}
/* Style the play button */
media-play-button {
--media-button-icon-width: 24px;
--media-button-icon-height: 24px;
--media-button-icon-transform: scale(1.2);
}
A complete listing of all notable changes to this project are documented in CHANGELOG.md.
This plugin is licensed under MIT.
This project incorporates Media Chrome, which is licensed under the MIT License.