Search code examples
htmlobjectvolume

How to mute an html object tag content


I have an html <object> in my site. I would like to mute content.

I have tried numerous variations of code

<object data="test.mp3">
<embed volume="0"/>
</object>

Solution

  • There is no standard API for interacting for media loaded into objects, so you can't.

    If you were to use the <audio> element then you could set:

    document.querySelector("audio").volume = 0;
    

    … with JavaScript.