Chrome/Webkit audio tag bug?

11,009

Solution 1

Bug in Chrome, possibly Webkit as well: http://code.google.com/p/chromium/issues/detail?id=25972

Short audio files won't play.

Solution 2

Try to host your audio file somewhere and try this:

audio = new Audio('http://www.yourhosting.com/chat.ogg');
audio.play();
Share:
11,009
Malik Adil
Author by

Malik Adil

Updated on July 20, 2022

Comments

  • Malik Adil
    Malik Adil almost 2 years

    I'm trying to get HTML5's audio tag to work in Chrome. The following code works flawlessly in Firefox, any ideas why it isn't working in Webkit?

    <html>
      <head>
        <script type="text/javascript">
        function init(){
         audio = new Audio("chat.ogg");
         audio.play(); 
        }
        </script>
    </head>
    <body onload="init()">
    </body>
    

    I should also note that I tried this with an mp3 as well. Regardless of what format, whenever .play() is called on audio, Chrome responds with "undefined".

  • Malik Adil
    Malik Adil over 14 years
    Yep. I'm using 5.0.342.1 dev on OSX 10.5