How to mute an iframe?
Asked Answered
V

1

13

I need to mute an iframe, but I don't know how to do it. Here is an example of what I have:

http://www.codecademy.com/en/bitAce74593/codebits/nW7U9b

Here you can hear the music from the website on the iframe, I need to automatically mute that audio. Hope that someone knows how to do it. Thanks

Vivanvivarium answered 17/8, 2014 at 22:17 Comment(1)
As of 2021, this is not currently possible. If you want it to be supported, staring this issue may help Chromium contributors gauge interest. If you have a specific use case, you can also leave a comment on that issue (but please don't comment simple/unhelpful things like "I need this!" - just star it instead)Reclinate
P
-6

you can mute it by js, example: just put this in your page:

<script type="text/javascript">
    myVid=document.getElementById("video1");
    myVid.muted=true;
</script>

you should replace "video1" by the id of your iframe, if the iframe don't have any id add an id to it as follow:

<iframe width="820" height="390" src="http://nyan.cat" id="iframeId"></iframe>
Phooey answered 17/8, 2014 at 22:59 Comment(4)
Thanks for your answer.I've tried this but It didn't work, please check the code im a beginner and I possibly made a mistake somewhere: codecademy.com/es/bitAce74593/codebits/nW7U9b Also I've tried to add to iframe that thing style="volume: silent;" but It doesn't work also.Vivanvivarium
@Alrynec the link that you posted has a self muting javascript code, I feel misunderstanding what do you really want, so could you please put your code on jsfiddle.net and share the link with us here.Phooey
Here you have it: jsfiddle.net/gpo16sLk That way videos aren't played so It's not working for my purpose, Im in search of an alternative to only mute audio. Nyan websites is just for example, Im not going to iframe that websiteVivanvivarium
Don't know why this is voted as the correct answer but it doesn't work.Tuba

© 2022 - 2024 — McMap. All rights reserved.