-
Notifications
You must be signed in to change notification settings - Fork 384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable/hide muted toggle in Video block when autoplay is enabled #4635
Comments
The “plays inline” toggle probably doesn't make sense either when “autoplay” is enabled. |
Just ran into the The plugin's validation tool did not warn me about this deprecation message, so I only learned it through Search Console. It would be great if the plugin would warn me about this. In ampproject/amphtml#28041 (comment) it was mentioned that it's difficult or even impossible to remove the "Muted" UI control in Gutenberg. If that's still the case, perhaps that can be reported upstream? |
It's been awhile since I looked at this, so I'm confused. You're seeing the |
Yes. It's absent, to be precise. But in the editor it's "off" like this: The markup is as follows: <figure class="wp-block-video"><amp-video width="1920" height="1080" controls="" muted="" poster="https://pascalbirchler.com/wp-content/uploads/2021/08/Web-Stories-Client-Side-Video-Optimization-poster.jpeg" src="https://pascalbirchler.com/wp-content/uploads/2021/08/Web-Stories-Client-Side-Video-Optimization.mp4" layout="responsive" class="i-amphtml-layout-responsive i-amphtml-layout-size-defined" i-amphtml-layout="responsive"><i-amphtml-sizer style="display:block;padding-top:56.25%"></i-amphtml-sizer><a href="https://pascalbirchler.com/wp-content/uploads/2021/08/Web-Stories-Client-Side-Video-Optimization.mp4" fallback="">https://pascalbirchler.com/wp-content/uploads/2021/08/Web-Stories-Client-Side-Video-Optimization.mp4</a><noscript><video width="1920" height="1080" controls muted poster="https://pascalbirchler.com/wp-content/uploads/2021/08/Web-Stories-Client-Side-Video-Optimization-poster.jpeg" src="https://pascalbirchler.com/wp-content/uploads/2021/08/Web-Stories-Client-Side-Video-Optimization.mp4" playsinline></video></noscript></amp-video><figcaption>Client-side video optimization in the Web Stories editor in action</figcaption></figure> Search Console complains:
|
Ah, it's specifically flagging the presence of The It is, however, on This was done 5 years ago: ampproject/amphtml@7cb88f7#diff-b9292e22ae04c8d88da089f65bb8e7c7a00d53cb971335179b9cfa303752c82a But the Therefore, it seems the quick fix here is just to omit the diff --git a/includes/sanitizers/class-amp-video-sanitizer.php b/includes/sanitizers/class-amp-video-sanitizer.php
index f929566b5..bbf4797cb 100644
--- a/includes/sanitizers/class-amp-video-sanitizer.php
+++ b/includes/sanitizers/class-amp-video-sanitizer.php
@@ -62,6 +62,9 @@ public function sanitize() {
if ( $this->args['add_noscript_fallback'] ) {
$this->initialize_noscript_allowed_attributes( self::$tag );
+
+ // Omit muted from noscript>video since it causes deprecation warnings in validator.
+ unset( $this->noscript_fallback_allowed_attributes['muted'] );
}
for ( $i = $num_nodes - 1; $i >= 0; $i-- ) { |
Bug Description
As discussed in ampproject/amphtml#28041, when an
amp-video
has theautoplay
attribute the video will forcibly be muted. As such, themuted
attribute has no effect and it is deprecated. Nevertheless, the Video block provides toggles for both autoplay and muted:When autoplay is toggled-on, there is actually an warning currently added and yet the Muted toggle is still displayed:
This is misleading on sites with the AMP plugin because even though the Muted toggle is not enabled, the video will still be muted.
Expected Behaviour
The Muted toggle should be either hidden, or a notice should be added to indicate that autoplay videos will be muted on AMP pages regardless of the Muted toggle state.
The
muted
attribute should he then omitted from theamp-video
elements created from the Video block.Steps to reproduce
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
Implementation brief
QA testing instructions
Demo
Changelog entry
The text was updated successfully, but these errors were encountered: