开发者

HTML5: How to play sound on every mobile device

开发者 https://www.devze.com 2023-04-11 06:14 出处:网络
I was wondering how to play sound on every mobile device. iPhone/i开发者_如何学PythonPad Android Windows Phone 7

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

精彩评论

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

关注公众号