News for hackers. Stuff that matters.
Re:How to play a sound in a web browser (it ain’t easy) by gmac on Thursday March 17, 2011 @06:48AM (#2335679)
The proposed solution uses JS to check what formats the browser reports support for, in order to tailor the <audio>'s src attribute:

    if(!!(a.canPlayType && 
          a.canPlayType('audio/ogg; codecs="vorbis"')
         .replace(/no/, '')))
      a.src = "/sounds/ping.ogg";
    else if ...
Does anyone know if this is more successful than the standard HTML5 way, which is to include in the <audio> element multiple <source> elements pointing to different formats?

There are no comments on this comment yet.