1

I've been researching for days to figure out how to resolve this with no luck. The PlayN JavaSound class uses the javax.sound.sampled.AudioSystem class to play sounds, and the mp3 format does not seem to be supported.

javax.sound.sampled.UnsupportedAudioFileException: could not get audio input stream from input stream at javax.sound.sampled.AudioSystem.getAudioInputStream(AudioSystem.java:1102) at playn.java.JavaSound.init(JavaSound.java:71) ......

I cannot find a lot of information on playing mp3s in Java with the AudioSystem class, so I am stuck. It seems like there is a new way to play mp3s in Java 7 with javafx.scene.media.MediaPlayer, but I would like to know if anyone knows the answer to this.

The Guy with The Hat
  • 10,836
  • 8
  • 57
  • 75
Jonah
  • 41
  • 1
  • 5

2 Answers2

2

I needed to download a plugin (I think it was this one: http://www.oracle.com/technetwork/java/javase/download-137625.html ). I am not sure if this was the case because I did my setup without Maven.

Stefan Haustein
  • 18,427
  • 3
  • 36
  • 51
  • Thanks Sefan! That got it. I came across that during my searching, but was confused about what jmf was exactly. It did not seem to be what I was looking for. Also, the link to the download is broken and no longer points to JavaMP3plugin.zip. I installed the Java Media Framework that the download points to, but that does not help. I found the mp3plugin.jar file from this answer http://stackoverflow.com/questions/8392241/where-can-i-download-the-mp3plugin-jar-to-play-mp3s-in-java-code and followed the instructions on the link you provided. – Jonah Jun 24 '12 at 22:27
0

I used this dependency to setup the mp3spi library which may wrk for your mp3 files:

compile group: 'com.googlecode.soundlibs', name: 'mp3spi', version: '1.9.5-1'

IcedDante
  • 6,145
  • 12
  • 57
  • 100