Enhance your video and audio blocks with custom web components from Media Chrome.
Media Chrome for Embed Blocks brings the power of Media Chrome to WordPress embed blocks. It enhances built-in video and audio embed 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.
- WordPress 6.7 or later
- PHP 7.4 or later
- 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 installto 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.7/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.7/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);
}Filters the list of enabled video providers. Receives an array of provider class names.
Default providers: Vimeo, Wistia, YouTube.
add_filter( 'media_chrome_providers_video', function ( $providers ) {
return array_filter( $providers, fn( $p ) => $p !== \S3S\WP\MediaChrome\Provider\Wistia::class );
});Filters the list of enabled audio providers. Empty by default.
add_filter( 'media_chrome_providers_audio', function ( $providers ) {
$providers[] = \S3S\WP\MediaChrome\Provider\Spotify::class;
return $providers;
});Filters the <media-controller> element HTML attributes.
Parameters:
$attributes(array) — HTML attributes.$block_attrs(array) — Block attributes.$custom_settings(array) — Merged custom settings.
Filters the <media-poster-image> element HTML attributes.
Parameters:
$attributes(array) — HTML attributes.$block_attrs(array) — Block attributes.$custom_settings(array) — Merged custom settings.
Filters the components displayed in the media control bar.
Parameters:
$components(array) — Array of component configurations keyed by tag name.
Filters the slots for a specific control bar component. The {$component} placeholder uses underscores instead of hyphens (e.g., media_chrome_control_bar_media_play_button_slots).
Parameters:
$slots(array) — Array of slot content keyed by slot name.$block_attrs(array) — Block attributes.
add_filter( 'media_chrome_control_bar_media_play_button_slots', function ( $slots, $block_attrs ) {
$slots['icon'] = '<svg>...</svg>';
return $slots;
}, 10, 2 );Filters the allowed HTML tags and attributes for control bar slot content (passed to wp_kses).
Parameters:
$allowed_tags(array) — Array of allowed tags and their attributes.
Filters the HTML attributes for a specific provider element. Replace {$slug} with the provider slug (e.g., youtube, vimeo, wistia, spotify).
Parameters:
$attributes(array) — HTML attributes.$slug(string) — Provider slug.
add_filter( 'media_chrome_youtube_provider_attributes', function ( $attributes, $slug ) {
$attributes['crossorigin'] = 'anonymous';
return $attributes;
}, 10, 2 );Filters the list of supported video provider slugs in the block editor.
Default: ['youtube', 'vimeo', 'wistia']
Filters the list of supported audio provider slugs in the block editor.
Default: []
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.