如何使用 HTML5 将音频合并到网站中?
我被要求为客户制作一个微型网站,他们希望它成为一个包含音频旁白的演示风格网站。
他们要求用 HTML5 来完成,但我还没有用 HTML5 制作任何东西。他们还希望它能够覆盖更广泛的受众,那么 HTML5 是否适用,最低的浏览器要求是什么?
除了 Flash 之外,还有一种方法可以为页面生成配音...也许是 jQuery 或者其他什么?
选项是否是
- HTML5,浏览器支持有限
- 基于 Flash 的网站,无法在 iPad/手机上查看 无
- 旁白!
I have been asked to produce a microsite for a client and they want it to be a presentation style website that will include audio narration.
They asked for it to be done in HTML5, but I haven't produced anything in HTML5 yet. Also they want it to reach a wide audience, so would HTML5 be applicable, what are the minimum browser requirements?
Other than Flash is there a way of producing voiceover for pages... jQuery maybe or anything else?
Would the options be
- HTML5 with limited browser support
- Flash based website which can't be viewed on an iPad/Phone
- No narration!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
每当您使用 HTML5 进行开发时,您都应该考虑提供向后兼容性的方法。
要确定最低浏览器要求,请访问此处:http://en.wikipedia.org/wiki/Comparison_of_layout_engines_ (HTML5)
使用 HTML5 音频:
http://www.w3schools.com/html5/html5_audio.asp
对于 HTML5 音频,您将需要至少两个声音文件副本才能访问每个浏览器:我会说一个是 mp3 格式,另一个是 Ogg Vorbis 格式。
您可以使用简单的浏览器检测 JavaScript 来确定浏览器并相应地提供内容: http://javascript.about .com/library/blbrsdet.htm
一般来说,最佳实践是确定支持,然后按顺序回退:
从本质上讲,始终提供最新、最好的服务,但首先要支持那些帮助您实现这一目标的技术。
Any time you're developing with HTML5, you should consider ways to offer backward compatibility.
To determine minimum browser requirements, please visit here: http://en.wikipedia.org/wiki/Comparison_of_layout_engines_(HTML5)
Using HTML5 Audio:
http://www.w3schools.com/html5/html5_audio.asp
For HTML5 Audio, you will need at least two copies of the sound file to hit every browser: I would say one in mp3 format, the other in Ogg Vorbis.
You can use a simple browser detection javascript to determine browser and serve content accordingly: http://javascript.about.com/library/blbrsdet.htm
Generally, best practice would be to determine support, then fall back in order:
<audio>
Essentially, always serve the latest and greatest, but support the technologies that got you there in the first place.
此代码应该高度兼容(IE6+),使用 WAVE:
另一种选择,同时使用 mp3/ogg 并且仍然非常兼容:
如果您不需要支持 IE9 及更早版本,则
标签应该足够了:
另一种播放音频的旧方式:
您还可以使用第三方库,例如 audio.js
This code should be highly compatible (IE6+), using WAVE:
Another option, using both mp3/ogg and still very compatible:
If you don't need to support IE9 and earlier, the
<audio>
tag should be enough:Another old way of playing audio:
And you could also use third-party libraries such as audio.js