Gwt-voices - wav文件不播放

gwt-voices - wav file not playing

本文关键字:播放 文件 wav Gwt-voices      更新时间:2023-09-26

我按照这个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);
    }
}

我错过了什么?

谢谢你的帮助。

您应该将音频文件相对于gwt应用程序中的war目录。假设你把你的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);