Skip to content

Make muted content attribute affect muted IDL attribute only once#12473

Open
foolip wants to merge 6 commits into
mainfrom
foolip/muted-once
Open

Make muted content attribute affect muted IDL attribute only once#12473
foolip wants to merge 6 commits into
mainfrom
foolip/muted-once

Conversation

@foolip

@foolip foolip commented May 21, 2026

Copy link
Copy Markdown
Member

The purpose of this is to limit the cases where the muted IDL attribute
can change without a volumechange event firing.

The notion that user agents may remember volume and muted is removed as
it would require additional muted states to handle correctly, but could
be reinstated if there is implementer interest.

  • At least two implementers are interested (and none opposed):
  • Tests are written and can be reviewed and commented upon at:
  • Implementation bugs are filed:
    • Chromium: …
    • Gecko: …
    • WebKit: …
    • Deno (only for timers, structured clone, base64 utils, channel messaging, module resolution, web workers, and web storage): …
    • Node.js (only for timers, structured clone, base64 utils, channel messaging, and module resolution): …
  • Corresponding HTML AAM & ARIA in HTML issues & PRs:
  • MDN issue is filed: …
  • The top of this comment includes a clear commit message to use.

(See WHATWG Working Mode: Changes for more details.)


/media.html ( diff )

@annevk

annevk commented May 21, 2026

Copy link
Copy Markdown
Member

What do implementations do today? I'm pretty sure WebKit doesn't have a "set once" special case.

@foolip

foolip commented May 21, 2026

Copy link
Copy Markdown
Member Author

Chromium reacts to muted content attribute changes but only for AttributeModificationReason::kByParser which can only happen once in HTMLMediaElement::ParseAttribute().

Gecko seems to look at the muted content attribute in two places: in HTMLMediaElement::DoneCreatingElement() and in HTMLMediaElement::CopyInnerTo(), which maybe is for cloning, not sure.

WebKit has a tri-state optional bool m_implicitlyMuted and a boolean m_explicitlyMuted. I'm not sure about m_implicitlyMuted, but m_explicitlyMuted is used as a once-only state bit when setting m_muted from the attribute in two places: in MediaElement::postConnectionSteps() and in MediaElement::loadResource().

@foolip

foolip commented May 21, 2026

Copy link
Copy Markdown
Member Author

For Gecko, the MutedReasons is also interesting and confirms that playbackRate can mute in Gecko. Seems like that doesn't fire a "volumechange" event.

@foolip

foolip commented May 21, 2026

Copy link
Copy Markdown
Member Author

cc @whatwg/media for opinions on this. In short, the topic is how/when the muted content attribute affects the muted IDL attribute, and which changes in the muted IDL attribute should fire a volumechange event.

Recent changes here are #12389 and #12428.

@annevk

annevk commented May 24, 2026

Copy link
Copy Markdown
Member

I see, perhaps observing the muted content attribute in the post-connection steps is a good alternative to the fictional "creation time". As that is a well-defined point in time.

That would require changing the :muted tests again I suspect.

@foolip foolip force-pushed the foolip/muted-once branch from 249e5dc to f6b7b0e Compare May 25, 2026 21:16
The purpose of this is to limit the cases where the muted IDL attribute
can change without a volumechange event firing.

The notion that user agents may remember volume and muted is removed as
it would require additional muted states to handle correctly, but could
be reinstated if there is implementer interest.
@foolip foolip force-pushed the foolip/muted-once branch from f6b7b0e to 295bb37 Compare May 25, 2026 21:19
@foolip

foolip commented May 25, 2026

Copy link
Copy Markdown
Member Author

@annevk that works for me, I've updated this PR and tests in https://crrev.com/c/7857861 to match.

@foolip foolip added the agenda+ To be discussed at a triage meeting label May 26, 2026

@annevk annevk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about the WebKit case of taking the muted content attribute into account when loading a new media resource?

Comment thread source Outdated
Comment thread source Outdated
Comment thread source Outdated
Comment thread source Outdated
Comment thread source Outdated
@foolip foolip force-pushed the foolip/muted-once branch from 6cccc77 to 025c4cf Compare June 4, 2026 08:14
Comment thread source Outdated
Comment thread source Outdated
Comment thread source Outdated
Comment thread source Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agenda+ To be discussed at a triage meeting topic: media

Development

Successfully merging this pull request may close these issues.

3 participants