Hi everyone,
I'm writing a databse program and I need to display the information stored in the properties of an audio/video file in a table. (for example name of the artist, genre, date of being released, name of the album and so on...)
I searched in JDK 5.0 documentation and I found the method properties() in class AudioFileFormat. It can return a map including all the information; but my problem is that
Java only supports some specific extensions like AIFF, wav and ... BUT I also have some audio files with mp3 formats and need to display those information too...
I know that because JMF(Java Media Framework) supports these extensions, it can play these songs. But my problem is that how I can use it ( or any software that supports those extensions) to retrieve those data.
Or do you have a better idea? Could you tell me please?
-----------> This is a piece of my code :
In the main method :
File aFile = new File("C://RitesOfPassage.mp3");
I pass this object (aFile) to the constructor of my class, and then it is passed like this :
//Some of these classes and method are only known by 'JMF'
MediaLocator mediaLocator = new MediaLocator(aFile.toURL());
Player player = Manager.createRealizedPlayer(mediaLocator);
//Here it gives error ... If I simply pass 'aFile' to the
//getAudioInputStream there would be no problem but when
//I do this it gives me UnsupportedAudioFileException and
//says it could not get audio input stream from input URL.
AudioInputStream in = AudioSystem.getAudioInputStream(mediaLocator.getURL());
AudioFormat format = in.getFormat();
System.out.println( format.properties() );
What should I do now? any idea ...?
Thanks in advance,
Maryam