how are u?
I am trying to make a single button for play/mute process for youtube iframe in wordpress header…
<iframe id="wp-custom-header-video" name="video-wp" frameborder="0" allowfullscreen="1" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" title="YouTube video player" width="2000" height="1200" src="https://www.youtube.com/embed/4vGzJ3nTzp4?autoplay=1&controls=0&disablekb=1&fs=0&iv_load_policy=3&loop=1&modestbranding=1&playsinline=1&rel=0&showinfo=0&enablejsapi=1&origin=https%3A%2F%2Fepistolariodelamemoria.cl&widgetid=1" data-gtm-yt-inspected-1_19="true" data-initial-width="2000" data-initial-height="1200"></iframe>
<div id="mute">
</div>
JS
$("#mute").on("click", function () {
var mute_toggle = $(this);
if (player.isMuted()) {
player.unMute();
mute_toggle.text("volume_up");
} else {
player.mute();
mute_toggle.text("volume_off");
}
});
but it doesn’t work for me, could you help me with this
3
Answers
It's work for me, Thanks!
Maybe this helps?:
https://stackoverflow.com/a/26478263/17135631
js :
html :
reference link : https://codepen.io/rno1d/pen/XzLKwj