开发者

Playing sound file doesn't work in all browser except IE

I have This line

<EMBED NAME=""mySound"" SRC=""DocID2858_voice-message.wav"" LOOP=FA开发者_StackOverflowLSE AUTOSTART=True HIDDEN=TRUE MASTERSOUND>

It works for ie but doesn't work for rest of browser. is there any way to make that.


If you're using IE 8, Firefox 3.5 and higher, Safari 4, Google Chrome, then you'll be aware that these browsers support HTML 5.

For HTML 5 use the <audio></audio> tag. More information can be found here.


SRC=""DocID2858_voice-message.wav""

You've doubled your quotes. I'm amazed if this still works in IE!

If you must use an <embed> tag, the syntax would be:

<embed id="mysound" src="DocID2858_voice-message.wav" type="audio/wav" loop="false" autostart="true" hidden="true">

The type attribute is necessary to prevent an unnecessary double-fetch in IE. mastersound was a Netscape 4 nonsense supported by nothing today. loop and autostart are not universally supported. autostart is universally hated.

Anyhow I'd strongly recommend against using <embed> these days. Or even the more up-to-date <object> way of embedding a media player. Embedded media players are fragile. They're often user-hostile or unreliable or just not present at all. Today, most authors use a Flash player to play back MP3 instead. (It's possible to play back WAV, but it's not very nice.)

Tomorrow, HTML5 <audio> elements will be used instead. It is possible to use <audio> with fallback to Flash today, but this will mean having more than one audio format on the server.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜