开发者

HTML5: How to play sound on every mobile device

I was wondering how to play sound on every mobile device.

This should work as a Webapp (HTML).


This is how you implement HTML5 audio into your page for every device:

<audio controls preload>
    <source src="path/to/file.ogg" type="audio/ogg" />
    <source src="path/to/file.mp3" type="audio/mpeg" />
    <!--
    Here comes the Flash (in case you want any) fallback,
    or you can write something here like this
    -->
    <p class="error-message">Try another browser...</p>
</audio>

If you are trying to use it via SSL, it's not gonna work, read this: https://stackoverflow.com/a/10089632/819194 This is what we have figured and how we have solved our stuff.

Regards!


Not sure about Bada, but avoiding Flash and instead using JavaScript or server-side browser/device detection to serve either .mp3 or .ogg files should cover most bases.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜