loverelop.blogg.se

Stop chrome autoplay video
Stop chrome autoplay video









stop chrome autoplay video

index.jsīrowser = () īackgroundAudio = setInterval(function(), 120000) // 120000 is the duration of your audio which in this case 2 mins.Īlso if you have a toggle event for your audio make sure to remove the created element for audio. It seems that audio auto-play is working so we don't need the element because it will create double audio running.

stop chrome autoplay video

Personally I prefer solution #2 because it is cleaner approach for not relying so much in JavaScript. There is also another workaround for this according to an iframe that doesn't play anything just to trigger the autoplay in the first load. $('#playAudio').remove() // just to make sure that it will not have 2x audio in the background

stop chrome autoplay video

And audio tag aswell for non-chrome browsers Īnd in my script var isChrome = /Chrome/.test(erAgent) & /Google Inc/.test(navigator.vendor)











Stop chrome autoplay video