darkmagic2002
Mitglied
Hey,
wie oben schon erwähnt, musst du den AudioInputStream buffern:
greets,
kevin
wie oben schon erwähnt, musst du den AudioInputStream buffern:
Java:
URL soundURL; //ist zu initialisieren
AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(soundURL);
BufferedInputStream bufferedInputStream = new BufferedInputStream(audioInputStream);
AudioFormat af = audioInputStream.getFormat();
int size = (int) (af.getFrameSize() * audioInputStream.getFrameLength());
byte[] audio = new byte[size];
DataLine.Info info = new DataLine.Info(Clip.class, af, size);
bufferedInputStream.read(audio, 0, size);
Clip clip = (Clip) AudioSystem.getLine(info);
clip.open(af, audio, 0, size);
clip.start();
greets,
kevin