Media: Add muted property for video elements.

This change allows for the muted property to be used in video elements which solves for content that wishes to `autoPlay` when a page is viewed. Adding `muted` to video elements adhears to the requirements browsers have to honor `autoPlay` functionality.

Props prokium, peterwilsoncc, costdev, johnbillion, Benouare.
Fixes #54788.

Built from https://develop.svn.wordpress.org/trunk@54128


git-svn-id: http://core.svn.wordpress.org/trunk@53687 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
antpb 2022-09-11 22:19:10 +00:00
parent bd607c1118
commit fbe878f68d
2 changed files with 5 additions and 2 deletions

View File

@ -3219,6 +3219,7 @@ function wp_get_video_extensions() {
* @type string $poster The 'poster' attribute for the `<video>` element. Default empty.
* @type string $loop The 'loop' attribute for the `<video>` element. Default empty.
* @type string $autoplay The 'autoplay' attribute for the `<video>` element. Default empty.
* @type string $muted The 'muted' attribute for the `<video>` element. Default false.
* @type string $preload The 'preload' attribute for the `<video>` element.
* Default 'metadata'.
* @type string $class The 'class' attribute for the `<video>` element.
@ -3263,6 +3264,7 @@ function wp_video_shortcode( $attr, $content = '' ) {
'poster' => '',
'loop' => '',
'autoplay' => '',
'muted' => 'false',
'preload' => 'metadata',
'width' => 640,
'height' => 360,
@ -3390,11 +3392,12 @@ function wp_video_shortcode( $attr, $content = '' ) {
'poster' => esc_url( $atts['poster'] ),
'loop' => wp_validate_boolean( $atts['loop'] ),
'autoplay' => wp_validate_boolean( $atts['autoplay'] ),
'muted' => wp_validate_boolean( $atts['muted'] ),
'preload' => $atts['preload'],
);
// These ones should just be omitted altogether if they are blank.
foreach ( array( 'poster', 'loop', 'autoplay', 'preload' ) as $a ) {
foreach ( array( 'poster', 'loop', 'autoplay', 'preload', 'muted' ) as $a ) {
if ( empty( $html_atts[ $a ] ) ) {
unset( $html_atts[ $a ] );
}

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.1-alpha-54127';
$wp_version = '6.1-alpha-54128';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.