Incorpora la nostra room



allow=”autoplay; camera; microphone; fullscreen; picture-in-picture; display-capture; midi; geolocation;”
src=”https://www.publicmusic.it/ninja/?room=Publicmusic&autogain=1&echocancellation=1&record=1000&transparent&proaudio=4&zoom=0&easyexit&muted&mutespeaker”
width=”100%”
height=”800″
frameborder=”0″>




// Simulazione click nell’iframe
const iframeId = “ninjaIframe”;
let retryCount = 0;
const maxRetries = 10;

function checkIframePresence() {
const iframe = document.getElementById(iframeId);

if (iframe && iframe.contentWindow) {
handleIframeLoad(iframe);
return;
}

retryCount++;
if (retryCount setTimeout(checkIframePresence, 1000);
}
}

function handleIframeLoad(iframe) {
try {
const iframeContent = iframe.contentWindow.document;

const containerButton = iframeContent.querySelector(“#container-3 button”);
const gowebcamButton = iframeContent.querySelector(“#gowebcam”);

if (containerButton) {
containerButton.click();
}

if (gowebcamButton && gowebcamButton.offsetParent !== null && !gowebcamButton.disabled) {
gowebcamButton.click();
} else {
const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
if (mutation.type === ‘attributes’ && mutation.target === gowebcamButton) {
if (gowebcamButton.offsetParent !== null && !gowebcamButton.disabled) {
gowebcamButton.click();
observer.disconnect();
}
}
});
});
observer.observe(gowebcamButton, { attributes: true });
}

} catch (error) {
// Silenziato
}
}

checkIframePresence();
});

Lascia un commento