问题描述
我已经研究了好几天要弄清楚如何,没有运气解决这个问题。该playn JavaSound类使用 javax.sound.sampled.AudioSystem
类播放声音和MP3格式似乎并没有得到支持。
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:无法获得音频
从输入流的输入流
javax.sound.sampled.AudioSystem.getAudioInputStream(AudioSystem.java:1102)
在playn.java.JavaSound.init(JavaSound.java:71)
......
我找不到播放MP3在Java中使用 AudioSystem
类很多信息,所以我卡住了。好像有在Java 7 javafx.scene.media.MediaPlayer
播放MP3一条新的途径,但我想知道是否有人知道这个问题的答案。
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.
推荐答案
我需要下载一个插件(我认为这是此一:的)。我不知道这是因为我做了我的设置而不Maven的情况。
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.
这篇关于playn的Java支持MP3 UnsupportedAudioFileException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!