开发者

html5 audio for everyone, except for firefox

开发者 https://www.devze.com 2023-02-19 08:45 出处:网络
I found a nice way to use the audio tag, Audio for everybody. It tries first to use the html5 player, then wmp, then flash, then an image.

I found a nice way to use the audio tag, Audio for everybody. It tries first to use the html5 player, then wmp, then flash, then an image.

Unfortunately, the mp3 format isn't supported on firefox even if it's supported by the os, and it displays an X instead of degrading to the f开发者_开发问答lash player.

There's a way to let firefox ignore the html5 player?

ps: converting all my mp3s to ogg it's not an option


I solved using this code: Quick Guide to Implementing the HTML5 Audio Tag (with Fallback to Flash)

The js code will detect lack of mp3 support in opera/firefox, hide the audio and create a flash player

edit: their solution to hide the controls does not work in my firefox, change

document.getElementsById('audio_with_controls').style.display = 'none';

with

var audio = document.getElementById("audio_with_controls");
audio.removeAttribute("controls");
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号