gpt4 book ai didi

java - 如何在我的 Java 程序中实现背景音乐?

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:55:49 25 4
gpt4 key购买 nike

<分区>

import sun.audio.*;
import java.io.*;
public class musicTest
{
public static void main(String[] args)
{
try
{
InputStream in = new FileInputStream("musicFile.mp3");
AudioStream as = new AudioStream(in);
AudioPlayer.player.start(as);
}
catch(FileNotFoundException e)
{
System.out.println("File does not exist or could not be found.");
System.out.println("FileNotFoundException: " + e.getMessage());
}
catch(IOException e)
{
System.out.println("Problem reading file.");
System.out.println("IOException: " + e.getMessage());
}
}
}

当我尝试编译程序时,它说,“AudioStream 是内部专有 API,可能会在未来的版本中删除...AudioPlayer 是内部专有 API,可能会在未来的版本中删除...”

我该如何解决这个问题?

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com