PlayN mp3 support UnsupportedAudioFileException
Asked Answered
O

2

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.

Orourke answered 24/6, 2012 at 3:47 Comment(0)
I
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.

Innovation answered 24/6, 2012 at 10:53 Comment(1)
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 #8392741 and followed the instructions on the link you provided.Orourke
C
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'

Casease answered 19/1, 2017 at 21:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.