I have the following HTML in place:

<audio id="msg" controls="false" preload="auto">
   <source src="aud/msg.mp3" type="audio/mpeg" />
   <source src="aud/msg.ogg" type="audio/ogg" />

It works fine in Firefox, Opera, and Chrome. In Safari 5 for Windows, I get the following error:

<source> is not allowed inside <audio>. Content ignored.

I was under the impression that Safari supported both <audio> and <source>, and a cursory Googling seems to support this assumption. Am I missing something?

1 answer


Your code works fine for me in Safari on windows (and Mac OS X). I assume you used an html5 doctype?

This is the code I tested:

<!DOCTYPE html>
<html lang="en">
    <meta charset="utf-8">
    <link rel="stylesheet" href="style.css">
    <script src="script.js"></script>
    <!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
    <audio id="msg" controls="false" preload="auto">
           <source src="test.mp3" type="audio/mpeg" />
           <source src="test.ogg" type="audio/ogg" />
Answered almost 9 years ago by Tony Crockford