Skip to content
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

add/remove muted attribute #1283

Merged
merged 2 commits into from
Jan 17, 2025
Merged

add/remove muted attribute #1283

merged 2 commits into from
Jan 17, 2025

Conversation

edsilv
Copy link
Member

@edsilv edsilv commented Jan 16, 2025

Unless the attribute is actually on the element, the browser doesn't recognise it as muted and won't autoplay. Also added missing volumechange handler to audio

Unless the attribute is actually on the element, the browser doesn't recognise it as muted and won't autoplay.
Also added missing volumechange handler to audio
Copy link

vercel bot commented Jan 16, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
universalviewer ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 17, 2025 9:57am

Copy link
Contributor

@demiankatz demiankatz left a comment

Choose a reason for hiding this comment

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

See below for a possible problem.

Comment on lines 112 to 116
if (muted) {
that.$media.attr("muted", "");
} else {
that.$media.removeAttr("muted");
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This will add or remove the muted attribute when the mute is applied from outside of MediaElement, but it will not have the same effect if the volume is changed from inside MediaElement. For example, if I click the external mute control, the audio element gets a "muted" attribute. But if I then raise the volume in the player itself, the attribute remains. Do we need to account for this in the volumechange event handlers for consistency?

Copy link
Contributor

@demiankatz demiankatz left a comment

Choose a reason for hiding this comment

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

Looks good to me now, @edsilv!

@demiankatz demiankatz merged commit fec1a53 into release-4.1.0 Jan 17, 2025
4 checks passed
@demiankatz demiankatz deleted the feature/mute-attribute branch January 17, 2025 13:03
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