Doug Molineux
Doug Molineux

Reputation: 12431

MP3 in Audio Tag in Firefox

I have this code that I'm using to play an MP3:

<p>Current Recording<br><br>
<audio controls='controls'><source src='".$rec_url."' type='audio/mp3' />
<a href='".$rec_url."'>Click to Download the Current Recording</a>
</audio></p>

I can see the Audio player in Chrome, and I can download the link in IE8. My problem is I just see a black box with an X in it on Firefox. I don't need to play it in this player in Firefox, I am aware that Firefox doesn't support the playing of MP3s.

But how do I get the link to show up?

Thanks!

UPDATE: This is what I see

enter image description here

Upvotes: 2

Views: 2138

Answers (2)

Doug Molineux
Doug Molineux

Reputation: 12431

I checked the error.code property of the element and then removed the entire tag and replaced it with a link if it had a value of 4.

Upvotes: 0

topek
topek

Reputation: 18979

Firefox does only support ogg and wave. You can do this:

<audio controls='controls'>
    <source src='".$rec_url."' type='audio/mp3' />
    <source src='".$rec_ogg_url."' type='audio/ogg' />
    <a href='".$rec_url."'>Click to Download the Current Recording</a>
</audio>

Upvotes: 4

Related Questions