I am trying to play an mp3 file using the JMF java library and an mp3 codec with the following code but i am getting an error and don know the source
package source;
import java.io.File;
import javax.media.Format;
import javax.media.Manager;
import javax.media.MediaLocator;
import javax.media.Player;
import javax.media.PlugInManager;
import javax.media.format.AudioFormat;
import javax.media.*;
public class AudioTest {
public static void main(String[] args) {
Format input1 = new AudioFormat(AudioFormat.MPEGLAYER3);
Format input2 = new AudioFormat(AudioFormat.MPEG);
Format output = new AudioFormat(AudioFormat.LINEAR);
PlugInManager.addPlugIn(
"com.sun.media.codec.audio.mp3.JavaDecoder",
new Format[]{input1, input2},
new Format[]{output},
PlugInManager.CODEC
);
try{
Player player = Manager.createPlayer(new MediaLocator(new File("C:\\Users\\Adetola-Ralph\\test\\f5\\1.mp3").toURI().toURL()));
player.start();
}
catch(Exception ex){
ex.printStackTrace();
}
}
}
*this is the error i am encountering
Failed to configure: com.sun.media.PlaybackEngine@1e7c42fe
Bad header in the media: Couldn't detect stream type
Error: Unable to realize com.sun.media.PlaybackEngine@1e7c42fe*