javax.sound.sampled.LineUnavailableException:系统不支持指定的格式

javax.sound.sampled.LineUnavailableException:系统不支持指定的格式,java,heroku,javasound,Java,Heroku,Javasound,我正在探索录音API。这在我的本地机器上运行良好,但当我在Heroku上部署相同的程序时,下面的代码行引发了一个异常: if (!AudioSystem.isLineSupported(info)) { throw new LineUnavailableException( "The system does not support the specified format."); } 该文件的格式为.wav。是因为Heroku上没有声卡,还是

我正在探索录音API。这在我的本地机器上运行良好,但当我在Heroku上部署相同的程序时,下面的代码行引发了一个异常:

 if (!AudioSystem.isLineSupported(info)) {
        throw new LineUnavailableException(
                "The system does not support the specified format.");
 }
该文件的格式为.wav。是因为Heroku上没有声卡,还是我遗漏了什么

下面是我试图在Heroku上执行的代码片段:

    format = getAudioFormat();
    DataLine.Info info = new DataLine.Info(TargetDataLine.class, format);

    // checks if system supports the data line
    if (!AudioSystem.isLineSupported(info)) {
        throw new LineUnavailableException(
                "The system does not support the specified format.");
    }

    audioLine = AudioSystem.getTargetDataLine(format);

    audioLine.open(format);
    audioLine.start();

    byte[] buffer = new byte[BUFFER_SIZE];
    int bytesRead = 0;

    recordBytes = new ByteArrayOutputStream();
    isRunning = true;

    while (isRunning) {
        bytesRead = audioLine.read(buffer, 0, buffer.length);
        recordBytes.write(buffer, 0, bytesRead);
    }

谢谢

据我所知,Heroku不支持声音。 要确定答案,请执行以下操作:

Mixer.Info[] mixerInfos = AudioSystem.getMixerInfo();
for (Mixer.Info[] info : mixerInfos) {
    System.out.println("Supported: " + info);
}
if (mixerInfos.length == 0) {
    System.out.println("Audio mixers are not supported.");
}
getMixerInfo()
的Javadocs中:

获取表示音频集的混音器信息对象数组 当前安装在系统上的混音器


为了更快地获得更好的帮助,发布一个or。这不起作用,你是对的,heroku不支持声音,他们没有预装声卡。让我试试aws或其他云供应商。我们的答案是正确的,我的意思是说heroku或任何服务器机器都没有现成的声卡支持。谢谢如果答案正确,请接受。谢谢