Hallo!
Ich möchte eine mp3 Datei abspielen.
Das Problem ist nur, dass ich folgende Fehlermeldung erhalte:
Ich habe gelesen, dass es an einer beschädigten Datei liegen könnte. Ich habe die Datei überprüft und es auch mit einer anderen versucht. - Gleiches Ergebnis!
Wo liegt das Problem?
Danke schonmal!
Ich möchte eine mp3 Datei abspielen.
Java:
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;
import com.sun.media.jfxmedia.AudioClip;
import com.sun.media.jfxmedia.Media;
import sun.audio.AudioPlayer;
import sun.audio.AudioStream;
public class Mp3 {
public static void main(String[] args) {
String path = "D:/test.mp3";
File file =new File(path);
try {
InputStream fis =new FileInputStream(file);
AudioStream as =new AudioStream(fis);
AudioPlayer player = AudioPlayer.player;
player.start(as);
} catch (Exception e) {
e.printStackTrace();
}
}
}
Das Problem ist nur, dass ich folgende Fehlermeldung erhalte:
Code:
java.io.IOException: could not create audio stream from input stream
at sun.audio.AudioStream.<init>(Unknown Source)
at Mp3.main(Mp3.java:26)
Wo liegt das Problem?
Danke schonmal!