Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Embed audio mp3 without using Flash

what is a nice way to embed audio mp3 in html page without using flash but with a custom skin? also it should work, partially, also in older browsers

like image 473
Francesco Avatar asked Mar 16 '11 19:03

Francesco


2 Answers

You should look at SoundManager 2.

It uses HTML5 if the browser supports it, but will degrade to using flash if it has to. The brilliant thing is that it has one API that works the same either way. I have used this tool on a few projects and it is amazing.

Here's a description from their How it works page

Problem: Browsers lack good, consistent native audio support. (HTML 5's Audio() is the future, but is still in development.)

Solution: Javascript API using HTML5 Audio() + headless Flash via ExternalInterface, works almost everywhere. If HTML5 is supported but "non-free" MP3/MP4 formats are not, flash is used as a fallback.

SoundManager 2 wraps and extends both the Flash and HTML Audio Sound APIs, providing a single, unified sound API to Javascript; the API is the same, whether HTML or Flash is ultimately used to play sound. (The flash portion is hidden, transparent to both developers and end users.)

like image 84
jessegavin Avatar answered Oct 20 '22 00:10

jessegavin


If you want it in older browser then you have to provide a Flash fallback. You can do it with jPlayer for example. jPlayer supports:

  • HTML5: mp3, m4a (AAC), m4v (H.264), ogv, oga, wav, webm
  • Flash: mp3, m4a (AAC), m4v (H.264)

Keep in mind that Firefox doesn't have a native MP3 support so if you use HTML5 audio you have to also provide Ogg Vorbis for Firefox and some other browsers.

like image 32
rsp Avatar answered Oct 20 '22 01:10

rsp