gpt4 book ai didi

java - 玩家监听器 MMAPI

转载 作者:行者123 更新时间:2023-12-02 07:30:52 25 4
gpt4 key购买 nike

运行程序时,音乐仍在运行,但控制台不打印消息。问题出在哪里?

我英语不好。抱歉。

public class MultimediaSound extends MIDlet {
public void startApp(){
try {
Player player = Manager.createPlayer(getClass().
getResourceAsStream("/tuner1.wav"),"audio/x-wav");

player.start();
player.addPlayerListener(new PlayerListener(){

public void playerUpdate(Player arg0, String arg1, Object arg2) {
if(arg1 == (PlayerListener.STARTED)){
System.out.print(arg2.toString()+" " + "dkm ");
}else{
System.out.print("dkm ");
}
}

});
} catch(Exception e) {
e.printStackTrace();
}
}

public void pauseApp() {}

public void destroyApp(boolean unconditional) {}
}

最佳答案

arg1 是您应该使用的字符串

if(arg1.equals(PlayerListener.STARTED))

关于java - 玩家监听器 MMAPI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12936247/

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