I have a client who has a young target audience and needs his site to play short "catch phrases" when the user clicks buttons. What would be the best way to go about this? I don't necessarily want to use Flash.
            Asked
            
        
        
            Active
            
        
            Viewed 239 times
        
    1
            
            
        - 
                    See this question: http://stackoverflow.com/questions/187098/cross-platform-cross-browser-way-to-play-sound-from-javascript – Dave Jun 17 '11 at 03:51
 
2 Answers
0
            If you're looking for a quick dropdown solution, try this library. (I've played a bit with it, and it seems reasonable.)
        Eli Barzilay
        
- 29,301
 - 3
 - 67
 - 110
 
0
            
            
        Yes, you can use it. If someone is using old, crappy browser then he just won't hear a clip - that's not a very big problem I guess.
You could do that using hidden <audio> element and piece of JavaScript.
        Crozin
        
- 43,890
 - 13
 - 88
 - 135
 
- 
                    You don't even have to hide it, just omit the controls boolean and you won't see it anyway. – kinakuta Jun 17 '11 at 04:15
 - 
                    
 - 
                    Just add a `click` listener to every button which fires a function that basically do nothing more but `document.getElementById("sound-player").play();`. – Crozin Jun 17 '11 at 04:27