PlayN mp3 support UnsupportedAudioFileException

a 夏天 提交于 2019-12-13 00:48:08

问题


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.


回答1:


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.




回答2:


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'



来源:https://stackoverflow.com/questions/11174813/playn-mp3-support-unsupportedaudiofileexception

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!