Error while playing some MP3s using JavaZOOM BasicPlayer classes

情到浓时终转凉″ 提交于 2019-12-21 21:28:02

问题


Here is the stack trace:

java.io.IOException: Resetting to invalid mark
    at java.io.BufferedInputStream.reset(BufferedInputStream.java:433)
    at org.tritonus.share.sampled.file.TAudioFileReader.getAudioInputStream(TAudioFileReader.java:324)
    at javazoom.spi.mpeg.sampled.file.MpegAudioFileReader.getAudioInputStream(Unknown Source)
    at javazoom.spi.mpeg.sampled.file.MpegAudioFileReader.getAudioInputStream(Unknown Source)
    at javax.sound.sampled.AudioSystem.getAudioInputStream(AudioSystem.java:1179)
    at javazoom.jlgui.basicplayer.BasicPlayer.initAudioInputStream(Unknown Source)
    at javazoom.jlgui.basicplayer.BasicPlayer.initAudioInputStream(Unknown Source)
    at javazoom.jlgui.basicplayer.BasicPlayer.open(Unknown Source)
    at BasicPlayerDemo.play(BasicPlayerDemo.java:49)
    at BasicPlayerDemo.main(BasicPlayerDemo.java:24)

Seems that other people are also having this problem:

  • Jukebox: no sound?
  • Stack trace on player state update

Any reason for this? I am trying to make a simple Java Swing music player using JavaZoom classes.


回答1:


There is a solution for this problem at (pelzkuh.de blog) It is in German but mainly says that the cause is an outdated library mp3spi1.9.4.jar. You have to replace it with the new one mp3spi1.9.5.jar. Links are provided in the pelzkuh blog entry.




回答2:


The thread with answers alludes to something I have struck before.

  1. MP3 is hardly any sort of 'standard' - with many extensions to the basic format. Java Sound based apps. will generally only deal with some of those types, and even if that were not the case
  2. Media players generally go to considerable effort to play 'any rubbish file' (including invalid ones) thrown at them. It would be a major effort to replicate that ability.

So is there no simple solution to this? Should I just ignore such MP3s?

  1. No
  2. That sounds pretty easy (simple). Skip them & go to the next track. Pop a dialog or add it to a log if the user chooses 'high feedback' in the player options.

Actually I'm making a mini-project for my college, so it doesn't look good if this player doesn't play certain files.

I'd check that with the people marking it. If they are expecting you to provide support for 'any file thrown at it' in a college project, they need to pull their head out of the clouds. I'll bet I could make files that play on one 'major player' but cause the next to lock up & die (OK.. thinking more of some recent video attempts, but the same basic principle applies). 'Handling media' is tricky.

..the college isn't expecting anything, since I chose to create this myself. I didn't know that handling media is tricky. Now if they ask, I can tell them that!

I suggest supplying the player complete with a play list and media controlled by you (and sure to be compatible with your player). You can find 3 basic, distributable MP3 tracks at my media page. Those are:

(parsable by) the JMF MP3 codec

..so JavaZoom should be able to load them as well.



来源:https://stackoverflow.com/questions/10046136/error-while-playing-some-mp3s-using-javazoom-basicplayer-classes

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