0
Hello.
I am working on a website and I would like a background sound to start playing automatically when I open the page.
However, it seems that Google has been censoring anything that brings autoplay and sound at the same time. That is, it is no longer possible by the traditional modes to have an automatic play of videos with sound and audio.
By doing my research, I’ve tried a lot of things. I’ve already put the prop muted and tried to remove it with timeout in jQuery. I have tried not to use prop autoplay and to trigger the . play() method when loading the page. I’ve tried six, seven different things and the degenerate doesn’t play automatically.
Until I arrived at this link here, where a solution is proposed using iframe and is shown a site where it actually works.
My problem is... I downloaded the audio Silence.mp3 from that user. I used basically the same code, just changing one thing or another id nomenclature and such. And it didn’t work.
<iframe src="path/silence.mp3" type="audio/mp3" allow="autoplay" id="audio" style="display:none"></iframe>
<audio id="bgsound" autoplay loop>
<source src="path/natureza.mp3" type="audio/mp3">
</audio>
I can’t understand how the same code works on the site the boy uploaded and it doesn’t work on what I’m creating. Could someone shed some light on that, please?
https://answall.com/questions/412109/ativando-som-em-video-background-p%C3%a1gina-html/412124#412124
– hugocsl
Good morning, Hugo. I had already seen this post. If you notice, I’ve already tried a similar solution, as I described in my post. However, I noticed that in your solution, it is necessary for the user to interact with the page, depending on a click or scroll that necessarily needs to be performed through the browser window. The site I posted as an example can, with that code snippet, activate the sound automatically without relying on any interaction. It would be a more satisfying result for what I need.
– BobeCampos
He even tried to give one
play()
in the video ononload()
page?– Nary Luiz
@Naryluiz already. I already tested with play() on onload(), already tried to load autoplay with muted and try to remove muted with a settimeout(). None of them work. So far, what I’ve come closest to making it work is so confusing that I can’t even explain it properly. But still, it doesn’t work completely.
– BobeCampos