MP3 in Audio Tag in Firefox

瘦欲@ 提交于 2020-01-04 05:25:12

问题


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


回答1:


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>



回答2:


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.



来源:https://stackoverflow.com/questions/7492163/mp3-in-audio-tag-in-firefox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!