BPS 0

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" />
</audio>

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

0
points

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">
  <head>
    <meta charset="utf-8">
    <title>title</title>
    <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]-->
  </head>
  <body>
    <audio id="msg" controls="false" preload="auto">
           <source src="test.mp3" type="audio/mpeg" />
           <source src="test.ogg" type="audio/ogg" />
        </audio>
  </body>
</html>
Answered over 6 years ago by Tony Crockford