Skip to content

Add support for muted property in Video Block for improved video sound control#6512

Merged
artf merged 2 commits intoGrapesJS:devfrom
ankitkoo7:dev
Jun 10, 2025
Merged

Add support for muted property in Video Block for improved video sound control#6512
artf merged 2 commits intoGrapesJS:devfrom
ankitkoo7:dev

Conversation

@ankitkoo7
Copy link
Contributor

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:

    • The muted attribute has been added as a boolean trait, allowing it to be set via the component interface.
    • For third-party providers (e.g., YouTube, Vimeo), the mute setting is now integrated into the generated embed URLs to ensure correct playback behavior.
  • Video Block View Adjustments:

    • The muted state is now applied to both native <video> elements and embedded <iframe> videos, ensuring consistent behavior regardless of the video source.
    • Dynamic updates to the mute state are handled appropriately via event listeners.
  • Trait and Event Integration:

    • The muted property is exposed in the editor through the trait manager.
    • Relevant events are registered to support runtime changes to the mute state.

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.

@artf artf merged commit 61ec659 into GrapesJS:dev Jun 10, 2025
3 checks passed
@artf
Copy link
Member

artf commented Jun 10, 2025

Thanks for the PR @ankitkoo7 great addition

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants