I have a java project that needs to play mp3 and aac files. I have created a MediaPlayer class that uses generic code to play sound files via the Java Sound API. I have two audo decoding libraries in my CLASSPATH that are registered as Java Sound SPIs. (MP3SPI and JAAD).
The problem is MP3SPI seems to take priority over JAAD. Meaning that when I play an AAC file, MP3SPI throws an exception and (obviously) doesn't play my song. When I remove MP3SPI from the CLASSPATH, the correct SPI (JAAD) is called, and my AAC files plays fine.
As this problem could probably be represented more generically, I'm hoping someone has some experience solving this.
How to provide support for both MP3 & AAC decoding/playback?