我遵循了 gwt-voices 快速入门 https://code.google.com/p/gwt-voices/wiki/GettingStarted创建并运行简单的 gwt-voices 项目。 我的问题是,当我运行我的项目(Firefox)时,声音没有播放,我不知道为什么。 这是我的代码:
public class GWTProject implements EntryPoint {
public void onModuleLoad() {
SoundController soundController = new SoundController();
Sound sound = soundController.createSound(Sound.MIME_TYPE_AUDIO_WAV_PCM,
"C:/path/to/the/file/bienvenue.wav");
sound.play();
System.out.println(sound);
}
}
我错过了什么?
感谢您的帮助。
最佳答案
您应该将与 war 目录相关的音频文件放入 gwt 应用程序中。 假设您将 wav 文件放入 MyProject/war/audio/bienvenue.wav
您编码,现在就可以
SoundController soundController = new SoundController();
Sound sound = soundController.createSound(Sound.MIME_TYPE_AUDIO_WAV_PCM,
"audio/bienvenue.wav");
sound.play();
System.out.println(sound);
关于java - gwt-voices - wav 文件未播放,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17134474/