Witam. Chce zrobic przycisk, coby po jego kliknieciu w tle zaczal sie slyszec dzwiek. Wiem jak to zrobic dla <video> ale nie mam pojecia jak dla youtubowego iframe. Ktos cos?
HTML
<div class="video-box">
<div id="videoPlayer" class="videoPlayer"></div>
</div>
<img id="volume" src="./Assets/Images/DevAssets/Video/Speaker_Icon.svg" alt="Mute icon">
JS
function unmuteVideo() {
$($video).prop('muted', false);
$('#volume').attr('src', './Assets/Images/DevAssets/Video/Mute_Icon.svg');
}
function muteVideo() {
$($video).prop('muted', true);
$('#volume').attr('src', './Assets/Images/DevAssets/Video/Speaker_Icon.svg');
}
function onYouTubeIframeAPIReady() {
var player;
player = new YT.Player('videoPlayer', {
videoId: 'G13uwkVERg4', // YouTube Video ID
playerVars: {
autoplay: 1, // Auto-play the video on load
controls: 0, // Show pause/play buttons in player
showinfo: 0, // Hide the video title
modestbranding: 0, // Hide the Youtube Logo
loop: 1, // Run the video in a loop
fs: 0, // Hide the full screen button
cc_load_policy: 0, // Hide closed captions
iv_load_policy: 3, // Hide the Video Annotations
autohide: 0,
playlist: 'G13uwkVERg4'
},
events: {
onReady: function (e) {
e.target.mute();
console.debug(e.target);
}
}
});
}