-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Video Block: Disable autoplay when video is not muted #69232
Video Block: Disable autoplay when video is not muted #69232
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
For me, the help text contains too many negatives. I would phrase it the other way around. |
Thank you for your suggestion @hanneslsm 🙇🏻 |
Maybe we should do something a little different. Enabling autoplay also mutes the video, disables mute control, and displays the help text for it. What do you think? cc @WordPress/gutenberg-design |
That's a great idea @Mamaduka ! 💡 Screen.Recording.2025-02-20.at.11.27.56.AM.movPlease let me know if this works, I can update the PR accordingly 👍🏻 |
Thank you, @Rishit30G! The example looks good. @hanneslsm what do you think? |
A very good UX improvement! Good suggestion @Mamaduka I'd only change the text |
Thanks for your suggestion |
useEffect( () => { | ||
if ( autoplay ) { | ||
setAttributes( { muted: true } ); | ||
} else { | ||
setAttributes( { muted: false } ); | ||
} | ||
}, [ autoplay, setAttributes ] ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's avoid using an effect for this and set the mute
attribute directly for the autoplay onChange
callback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Mamaduka, I have updated the PR ✅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @Rishit30G!
Co-authored-by: Rishit30G <[email protected]> Co-authored-by: Mamaduka <[email protected]> Co-authored-by: hanneslsm <[email protected]> Co-authored-by: yogeshbhutkar <[email protected]> Co-authored-by: Infinite-Null <[email protected]> Co-authored-by: carolinan <[email protected]>
What?
Closes #69218
Why?
The users are unaware that the video is not playing when autoplay is enabled but the mute option is not selected.
How?
This PR disables the autoplay toggle when the video is not muted and displays a user-friendly message prompting the user to enable the mute option for autoplay to work.
Implementation is based on this comment #69218 (comment)
Testing Instructions
Screenshots or screencast
Screen.Recording.2025-02-18.at.7.32.18.PM.mov