Autoplay music on a website without permission.

I would like to automatically play music in the background of my page with a 404 error. However, I need to sync it to a little animation. I used

<embed> 

tag. However, it asks for permission to run quicktime. When the user accepts it, the animation will end. I also tried autoplaying YouTube videos, but it usually takes 3-5 seconds to buffer depending on one internet connection. This is too long. Is there any solution for automatically playing a song without any permissions?

+4
source share
2 answers

Using the <audio> , this will work in most browsers:

 <![if (!IE)|(gte IE 9)]> <audio id="speak" autoplay> <source src="speak_a.ogg" type="audio/ogg" /> <source src="speak_a.mp3" type="audio/mpeg" /> </audio> <![endif]> <!--[if lt IE 9]> <bgsound id="speak" name="speak" autostart="true" loop="1"> <script>document.all['speak'].src='speak_a.mp3'</script> <![endif]--> 

Also see my other answer in How to enable audio on a website using HTML5?

+1
source

I think you could do this without flash using 100% HTML5 depending on your requirements (which browser support do you need). It will be

Here is a good example: http://hungry-media.com/code/html5-audio-sync/

(Refers to this blog post: http://hungry-media.com/2010/09/synchronizing-audio-with-html5/ )

+2
source

All Articles