问题
My question might be weird, but I don't know how to phrase it…
Actually, I would like to know whether or not the user's browser support mp3, ogg and wav files (I want the information for each). I know, I could just make the distinction between firefox and safari/chrome for a start, but there are several browsers I wouldn't take into consideraton.
How could I proceed ?
Thanks !
回答1:
The only way to reliably detect HTML5 audio (and subsequently codec support) is to do so client-side. The only capability available to you with PHP (or anything server-side) is to do user-agent sniffing, which is notoriously unreliable.
回答2:
Modernizr will do the deal in the end. http://modernizr.com/docs/#features-html5 Thank you !
来源:https://stackoverflow.com/questions/18678400/knowing-with-php-if-the-browser-can-play-audio-file-with-html5-audio-tag