Add support for muted property in Video Block for improved video sound control #6512
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This pull request introduces support for the
muted
property in the Video Block component within GrapesJS. This addition enables more precise control over video sound behavior, improving compatibility with autoplay requirements and overall user experience.Changes Introduced
Video Block Model Enhancements:
muted
attribute has been added as a boolean trait, allowing it to be set via the component interface.Video Block View Adjustments:
muted
state is now applied to both native<video>
elements and embedded<iframe>
videos, ensuring consistent behavior regardless of the video source.Trait and Event Integration:
muted
property is exposed in the editor through the trait manager.Motivation
Due to modern browser restrictions, autoplaying videos must be muted by default. This update ensures that videos embedded using the Video Block component comply with these requirements, thereby avoiding unexpected playback issues. It also provides developers with greater control over media presentation within the GrapesJS environment.
Additional Notes
This enhancement improves both compliance and usability, offering a more complete and configurable video embedding experience across all supported platforms.