diff --git src/wp-includes/media-template.php src/wp-includes/media-template.php
index bd0e31f..c07d59b 100644
|
|
function wp_underscore_video_template() { |
102 | 102 | } |
103 | 103 | endforeach; |
104 | 104 | ?><# |
105 | | <?php foreach ( array( 'autoplay', 'loop' ) as $attr ): |
| 105 | <?php foreach ( array( 'autoplay', 'loop', 'muted' ) as $attr ): |
106 | 106 | ?> if ( ! _.isUndefined( data.model.<?php echo $attr ?> ) && data.model.<?php echo $attr ?> ) { |
107 | 107 | #> <?php echo $attr ?><# |
108 | 108 | } |
… |
… |
function wp_print_media_templates() { |
1186 | 1186 | <span><?php _e( 'Loop' ); ?></span> |
1187 | 1187 | </label> |
1188 | 1188 | |
| 1189 | <label class="setting checkbox-setting"> |
| 1190 | <input type="checkbox" data-setting="muted" /> |
| 1191 | <span><?php _e( 'Muted' ); ?></span> |
| 1192 | </label> |
| 1193 | |
1189 | 1194 | <label class="setting" data-setting="content"> |
1190 | 1195 | <span><?php _e( 'Tracks (subtitles, captions, descriptions, chapters, or metadata)' ); ?></span> |
1191 | 1196 | <# |
diff --git src/wp-includes/media.php src/wp-includes/media.php
index 1981f3a..4e69406 100644
|
|
function wp_get_video_extensions() { |
2417 | 2417 | * @type string $poster The 'poster' attribute for the `<video>` element. Default empty. |
2418 | 2418 | * @type string $loop The 'loop' attribute for the `<video>` element. Default empty. |
2419 | 2419 | * @type string $autoplay The 'autoplay' attribute for the `<video>` element. Default empty. |
| 2420 | * @type string $muted The 'muted' attribute for the `<video>` element. Default empty. |
2420 | 2421 | * @type string $preload The 'preload' attribute for the `<video>` element. |
2421 | 2422 | * Default 'metadata'. |
2422 | 2423 | * @type string $class The 'class' attribute for the `<video>` element. |
… |
… |
function wp_video_shortcode( $attr, $content = '' ) { |
2460 | 2461 | 'poster' => '', |
2461 | 2462 | 'loop' => '', |
2462 | 2463 | 'autoplay' => '', |
| 2464 | 'muted' => '', |
2463 | 2465 | 'preload' => 'metadata', |
2464 | 2466 | 'width' => 640, |
2465 | 2467 | 'height' => 360, |
… |
… |
function wp_video_shortcode( $attr, $content = '' ) { |
2584 | 2586 | 'poster' => esc_url( $atts['poster'] ), |
2585 | 2587 | 'loop' => wp_validate_boolean( $atts['loop'] ), |
2586 | 2588 | 'autoplay' => wp_validate_boolean( $atts['autoplay'] ), |
| 2589 | 'muted' => wp_validate_boolean( $atts['muted'] ), |
2587 | 2590 | 'preload' => $atts['preload'], |
2588 | 2591 | ); |
2589 | 2592 | |
2590 | 2593 | // These ones should just be omitted altogether if they are blank |
2591 | | foreach ( array( 'poster', 'loop', 'autoplay', 'preload' ) as $a ) { |
| 2594 | foreach ( array( 'poster', 'loop', 'autoplay', 'muted', 'preload' ) as $a ) { |
2592 | 2595 | if ( empty( $html_atts[$a] ) ) { |
2593 | 2596 | unset( $html_atts[$a] ); |
2594 | 2597 | } |
diff --git tests/phpunit/tests/media.php tests/phpunit/tests/media.php
index 20b670f..b71e598 100644
|
|
VIDEO; |
810 | 810 | |
811 | 811 | /** |
812 | 812 | * @ticket 35367 |
| 813 | * @ticket 42718 |
813 | 814 | * @depends test_video_shortcode_body |
814 | 815 | */ |
815 | 816 | function test_wp_video_shortcode_attributes() { |
… |
… |
VIDEO; |
820 | 821 | $this->assertContains( 'src="https://example.com/foo.mp4', $actual ); |
821 | 822 | $this->assertNotContains( 'loop', $actual ); |
822 | 823 | $this->assertNotContains( 'autoplay', $actual ); |
| 824 | $this->assertNotContains( 'muted', $actual ); |
823 | 825 | $this->assertContains( 'preload="metadata"', $actual ); |
824 | 826 | $this->assertContains( 'width="640"', $actual ); |
825 | 827 | $this->assertContains( 'height="360"', $actual ); |
… |
… |
VIDEO; |
830 | 832 | 'poster' => 'https://example.com/foo.png', |
831 | 833 | 'loop' => true, |
832 | 834 | 'autoplay' => true, |
| 835 | 'muted' => true, |
833 | 836 | 'preload' => true, |
834 | 837 | 'width' => 123, |
835 | 838 | 'height' => 456, |
… |
… |
VIDEO; |
840 | 843 | $this->assertContains( 'poster="https://example.com/foo.png', $actual ); |
841 | 844 | $this->assertContains( 'loop="1"', $actual ); |
842 | 845 | $this->assertContains( 'autoplay="1"', $actual ); |
| 846 | $this->assertContains( 'muted="1"', $actual ); |
843 | 847 | $this->assertContains( 'preload="1"', $actual ); |
844 | 848 | $this->assertContains( 'width="123"', $actual ); |
845 | 849 | $this->assertContains( 'height="456"', $actual ); |