How to add chat sound notifications?
Hey, I have developed a chat site and would like to add a sound notification (beep or something) when there is a new message kind of like facebook chat.
I know 开发者_高级运维this requires flash but have no idea on how this could be accomplished. Can anybody explain how to make this or a good resource that explains it?
You can use SoundManager 2. "By wrapping and extending HTML5 and Flash Audio APIs, SoundManager 2 brings reliable cross-platform audio to JavaScript."
I don't want to rain on the HTML5 parade, but as I understand it, the audio tag currently has about 50% market reach (according to http://caniuse.com/#search=audio) and there is an issue regarding formats, Firefox doesn't support MP3, so I would recommend letting SoundManager 2 take care of such issues.
Forget using Flash for this. Use either HTML5 (http://www.w3schools.com/html5/tag_audio.asp), or the old fashioned way (http://www.world-voices.com/resources/addaud.html#350).
Best of luck.
精彩评论