I need to encode an mp3 audio file with base64, then sent to client(web browser), decode it via javascript, then play it.
Is there a way to play an mp3 file via javascript?
I need to encode an mp3 audio file with base64, then sent to client(web browser), decode it via javascript, then play it.
Is there a way to play an mp3 file via javascript?
You can use a flash plugin or java plugin. There is no other way to produce audio without HTML5 features, even if you wrote your own MP3 codec in "pure" JavaScript.
jPlayer and SoundManager2 are the two main javascript media playback libraries
You can use an object tag. Something like
<object type="audio/mpeg" data="music.mp3">
<param name="autoplay" value="true">
No audio player. Please upgrade to a newer browser.
</object>
You will have limited control over the playing of the mp3 and browser support can be spotty, but that should work.