I need quite fast methods for playing sounds/ displaying graphics in a web browser. I came across O3D which does nicely for the 2D graphics aspects but as far as I can tell there is no neat way to play audio from a JavaScript function.
My requirements are that multiply sounds be playable simultaneously and also that each sound start to play quickly (low latency). I'd also like to avoid further plugins if possible. Is this a case of pick any two (out of three)?
Any ideas or suggestions?
I need quite fast methods for playing sounds/ displaying graphics in a web browser. I came across O3D which does nicely for the 2D graphics aspects but as far as I can tell there is no neat way to play audio from a JavaScript function.
My requirements are that multiply sounds be playable simultaneously and also that each sound start to play quickly (low latency). I'd also like to avoid further plugins if possible. Is this a case of pick any two (out of three)?
Any ideas or suggestions?
Share Improve this question asked Jul 11, 2009 at 23:23 PythonPowerPythonPower 1- Possible duplicate: stackoverflow./questions/187098/… – Anderson Green Commented Feb 22, 2013 at 19:11
3 Answers
Reset to default 4So far I don't know anything better than SoundManager. Basically it's Flash wrapper that exposes audio player functionality to JavaScript
This page might be of interest to you:
"Demonstration of Different Ways to Play a Sound from a Web Page"
It covers this:
- Normal Hyperlink to a Sound File
- Embedding a Sound File
- Controlling an Embedded Sound using JavaScript (New)
- Using a Background Sound and JavaScript
- Using Dynamic HTML
- Using a Java Applet
- Using a Java Applet called from JavaScript
- Increasing patibility with Real Player
It doesn't cover Flash, and you don't seem to want to use it. However, nowadays flash has a large install base. It's not unreasonable to ask visitors to have flash installed if you're going to do advanced audio stuff on your page. Flash works properly on almost every OS and browser that you can think of (unlike silverlight), so I'd definitely consider using it.
The Man In Blue (A JavaScript guru) wanted to play with sound on the web with fine control over short sounds (like one might have in a game).
He blogged about it here, and created a demo JavaScript Drum Machine based on it.
That said, if you really want great control, check out SoundManager 2, it provides a fairly robust API.