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".
Bug in Chrome, possibly Webkit as well: http://code.google.com/p/chromium/issues/detail?id=25972
Short audio files won't play.
Try to host your audio file somewhere and try this:
audio = new Audio('http://www.yourhosting.com/chat.ogg');
audio.play();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With