So, I made a code with jquery that after 8 seconds of open index page displays a message div with audio.
$(document).ready(function () {
// Mostra a div após 8 segundos
setTimeout(function() {
$('.informativo').show().append('<embed src="<?php echo $address ?>sound.mp3" autostart="true" hidden="true" loop="false">');
// Esconde a div após 8 segundos
setInterval(function () {
$('.informativo').fadeOut();
}, 8000);
}, 4000);
});
<div class="informativo">
<p>Mensagem de alerta com audio</p>
</div>
But I'm having a problem that if I open this index page and mute the tab, the div appears in the normal index tab, but the audio only runs when I go back to the index!
I wanted the audio in the embed to roll even though I was on another flap!