开发者

Play Sound Using HTML 5 on Web Application

I'm building a web application to support RPG games, like Dungeons & Dragons. It's like a AJAX chat room with dice rollers, avatars, shared information, character sheets and so on...

One of my desired features is to let the game master to play music to all game members.

How can I im开发者_StackOverflow社区plement that?

I'm building the application with Asp.NET, using C# 3.5.

In the client side I'm using jQuery (latest version).

I intend to avoid Flash and Silverlight (even if the music resource will be available to some browsers only).

I tryed to use ogg format, but I don't know how to make it work with my own audio files. Do I need to implement a stream or something?

The application already is online. If someone want to see it, let me know. But it's only available in portuguese (Brazil).

Any tip will be apreciated.


You have a better chance of integrating the sound if its a mp3, then using javascript or HTML5.

HTML5 Code:

<audio src="anyone-there.mp3" autoplay controls></audio>

Read more here - http://www.html5laboratory.com/playing-with-audio-files.php

HTML5 is not supported by many browsers, so using a javascript to play the sound would be alot better.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜