1

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?

Eric Leschinski
  • 146,994
  • 96
  • 417
  • 335
BigDiggers
  • 105
  • 1
  • 3
  • 8

3 Answers3

3

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.

Dagg Nabbit
  • 75,346
  • 19
  • 113
  • 141
1

jPlayer and SoundManager2 are the two main javascript media playback libraries

Lloyd
  • 8,204
  • 2
  • 38
  • 53
0

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.