简单的 Java Sound Applet 不起作用!!! ARG!
import java.applet.*;
/**
* SoundApplet.java - a simple applet that plays the "gong.au" sound file.
*/
public class AppletGame extends Applet
{
public void init()
{
super.init();
resize(0,0);
AudioClip gong = getAudioClip(getDocumentBase(), "test0.au");
gong.play();
}
}
在 Eclipse applet 查看器中,它会加载但不播放声音。在 html 中,它无法加载并显示启动未初始化。我尝试在 init 之外调用它,并且有人帮助我!
import java.applet.*;
/**
* SoundApplet.java - a simple applet that plays the "gong.au" sound file.
*/
public class AppletGame extends Applet
{
public void init()
{
super.init();
resize(0,0);
AudioClip gong = getAudioClip(getDocumentBase(), "test0.au");
gong.play();
}
}
In Eclipse applet viewer it loads and doesn't play sound. In html it doesn't load and says start not initalized. I've tried calling it outside of init, and all that someone help me!!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否尝试过稍长的示例程序,例如 http://www.iam。 ubc.ca/guides/javatut99/sound/playing.html?
Have you tried slightly longer example programs like http://www.iam.ubc.ca/guides/javatut99/sound/playing.html ?