Html HTML5 音频支持哪些音频格式
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6762372/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
HTML5 audio what audio formats are supported
提问by Max
I have short sound that I wish to play in my webapp using HTML5. I save it in 3 formats. wav, mp3 and ogg
我有很短的声音,我希望使用 HTML5 在我的 web 应用程序中播放。我将它保存为 3 种格式。wav、mp3 和 ogg
I created 3 tags to play in different formats.
我创建了 3 个标签以不同的格式播放。
<audio controls autobuffer>
<source src="random_d5c589b1.wav" type="audio/x-wav">
</audio>
<audio controls autobuffer>
<source src="random_d5c589b1.ogg" type="application/ogg">
</audio>
<audio controls autobuffer>
<source src="random_d5c589b1.mp3" type="audio/mpeg">
</audio>
IE9 shows that it can play mp3 and it plays
IE9显示它可以播放mp3并且播放
FF5 shows that it can play wav, ogg. I do not hear it.
FF5显示可以播放wav、ogg。我听不见。
Chrome 12 is able to play all 3 formats but I do not hear anything.
Chrome 12 能够播放所有 3 种格式,但我听不到任何声音。
When I use different audio files I can hear them in FF and Chrome. But I can't hear those I need.
当我使用不同的音频文件时,我可以在 FF 和 Chrome 中听到它们。但我听不到那些我需要的。
Here is example:- http://kvartira-n.com/test-site/sound2.html
这是示例:- http://kvartira-n.com/test-site/sound2.html
Thanks to Juhana. The problem was that I had only 2 channel speakers and 5+1 was selected in Windows. It is not clear to me why but some audio 2 channel files were hearable and other wasn't.
感谢朱哈娜。问题是我只有 2 个声道的扬声器,并且在 Windows 中选择了 5+1。我不清楚为什么,但有些音频 2 声道文件可以听到,而另一些则不能。
Thanks everyone problem is resolved now.
谢谢大家 问题现在解决了。
回答by AshleysBrain
You might be interested in a blog post I made recently on HTML5 audio formats. You probably just want to go with AAC and Ogg Vorbis.
您可能对我最近发表的关于HTML5 音频格式的博文感兴趣。您可能只想使用 AAC 和 Ogg Vorbis。