lisovaccaro
lisovaccaro

Reputation: 33956

What is the most "compatible" way of autoplaying sound?

I want to add a sound in my page that autoplays but it seems like all ways require some plugin or codex or idk so I'm not quite sure what is the best audio format and way to code it so it works for most users and browsers.

Is there some way to works for most people?

Thanks

Upvotes: 2

Views: 3403

Answers (1)

Farzin Zaker
Farzin Zaker

Reputation: 3606

you can use BGSOUND tag like this :

<BGSOUND SRC="waitng2.wav" LOOP="2"> 

but only accepts WAV and MID formats.

for MP3 formats you can use EMBED tag but in some browser need plugin to be played.

<embed src="http://www.davesite.com/webstation/html/davesite.mp3" 
   loop="true" autoplay="false" width="145" height="60"></embed>

you can also use compination of these two ways to correct compatablity problem:

<NOEMBED><BGSOUND SRC="waitng2.wav" LOOP="2"></NOEMBED>
<EMBED SRC="waitng2.mp3" HEIGHT="0" WIDTH="0" AUTOSTART="TRUE"></EMBED> 

Upvotes: 2

Related Questions