Custom Mute Button for Audio Embedding?

前端 未结 2 1919
小鲜肉
小鲜肉 2021-01-21 16:08

I\'m trying to set up a custom mute button for the embed tag.


相关标签:
2条回答
  • 2021-01-21 16:18

    This is obviously an old question, but I had a similar issue... probably not the best solution, but I just placed the embed in a div and removed that div on the 'mutebutton' click, then hid the mute button:

    <a href="#" id="mutebutton">mute</a>
    
    <div id="soundDiv"><embed...></embed></div>
    
    $("#mutebutton").click(function() {
                $(this).hide();
                var div = document.getElementById("soundDiv");
                div.parentNode.removeChild(div);
            });
    

    I'm still a noob, so this may not work for you. But it did for me!

    0 讨论(0)
  • 2021-01-21 16:27

    Nope, there is no muted attribute for embed elements. If you want control over the volume you'll need to use the audio element or a proprietary plugin that you can pass parameters to.

    0 讨论(0)
提交回复
热议问题