Im trying to play a file to my speakers using AudioClip. To mention i run this on a docker container
Here i get the audio file info from my server and tried to play it.
int length = fromServer.readInt();//takes audio file length from socket
if (length > 0) {
byte[] message = new byte[length];
fromServer.readFully(message, 0, message.length);//reads the data in socket into array "message"
AudioInputStream oAIS = new AudioInputStream(
new ByteArrayInputStream(message),
new AudioFormat(44100.0f, 16, 2, true, false),length);
//creates an AudioInputStream which can be used for playing the data
AudioPlayer.main(oAIS);
}
When my programm enters this function i get
javax.sound.sampled.LineUnavailableException
at org.classpath.icedtea.pulseaudio.PulseAudioMixer.openImpl(PulseAudioMixer.java:714)
at org.classpath.icedtea.pulseaudio.PulseAudioMixer.openLocal(PulseAudioMixer.java:588)
at org.classpath.icedtea.pulseaudio.PulseAudioMixer.openLocal(PulseAudioMixer.java:584)
at org.classpath.icedtea.pulseaudio.PulseAudioMixer.open(PulseAudioMixer.java:579)
at org.classpath.icedtea.pulseaudio.PulseAudioDataLine.open(PulseAudioDataLine.java:94)
at org.classpath.icedtea.pulseaudio.PulseAudioDataLine.open(PulseAudioDataLine.java:283)
at org.classpath.icedtea.pulseaudio.PulseAudioClip.open(PulseAudioClip.java:402)
at org.classpath.icedtea.pulseaudio.PulseAudioClip.open(PulseAudioClip.java:453)
what might be wrong? If i have to provide any other information please tell me
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…