Java 类com.google.gwt.dom.client.AudioElement 实例源码

项目:GWT-AL    文件:AudioDecoder.java   
public static boolean isSupported(FileFormat format)
{
    if (tempAudioElement == null)
        tempAudioElement = Document.get().createAudioElement();

    switch (format)
    {
        case MP3:
            return !tempAudioElement.canPlayType(AudioElement.TYPE_MP3).equals(MediaElement.CANNOT_PLAY);

        case WAV:
            return !tempAudioElement.canPlayType(AudioElement.TYPE_WAV).equals(MediaElement.CANNOT_PLAY);

        case OGG:
            return !tempAudioElement.canPlayType(AudioElement.TYPE_OGG).equals(MediaElement.CANNOT_PLAY);

        case WEBM:
            return !tempAudioElement.canPlayType("audio/webm").equals(MediaElement.CANNOT_PLAY);
    }

    return false;
}
项目:empiria.player    文件:ReAttachAudioUtilTest.java   
@Before
public void setUp() throws Exception {
    util = new ReAttachAudioUtilMock();
    audioMock = mock(Audio.class);
    when(audioMock.getAudioElement()).thenReturn(mock(AudioElement.class));
    when(audioMock.getParent()).thenReturn(mock(FlowPanel.class));
}
项目:risk    文件:SoundResource.java   
private void loadDiceAudio() {
  diceAudio = Audio.createIfSupported();
  if (diceAudio != null) {
    diceAudio.addSource(gameSounds.diceRollMp3().getSafeUri().asString(), AudioElement.TYPE_MP3);
    diceAudio.addSource(gameSounds.diceRollOgg().getSafeUri().asString(), AudioElement.TYPE_OGG);
    diceAudio.addSource(gameSounds.diceRollWav().getSafeUri().asString(), AudioElement.TYPE_WAV);
    diceAudio.load();
  }
}
项目:risk    文件:SoundResource.java   
private void loadDeployAudio() {
  deployAudio = Audio.createIfSupported();
  if (deployAudio != null) {
    deployAudio.addSource(gameSounds.deployMp3().getSafeUri().asString(), AudioElement.TYPE_MP3);
    deployAudio.addSource(gameSounds.deployOgg().getSafeUri().asString(), AudioElement.TYPE_OGG);
    deployAudio.addSource(gameSounds.deployWav().getSafeUri().asString(), AudioElement.TYPE_WAV);
    deployAudio.load();
  }
}
项目:risk    文件:SoundResource.java   
private void loadAttackAudio() {
  attackAudio = Audio.createIfSupported();
  if (attackAudio != null) {
    attackAudio.addSource(gameSounds.attackMp3().getSafeUri().asString(), AudioElement.TYPE_MP3);
    attackAudio.addSource(gameSounds.attackOgg().getSafeUri().asString(), AudioElement.TYPE_OGG);
    attackAudio.addSource(gameSounds.attackWav().getSafeUri().asString(), AudioElement.TYPE_WAV);
    attackAudio.load();
  }
}
项目:risk    文件:SoundResource.java   
private void loadCardAudio() {
  cardAudio = Audio.createIfSupported();
  if (cardAudio != null) {
    cardAudio.addSource(gameSounds.cardMp3().getSafeUri().asString(), AudioElement.TYPE_MP3);
    cardAudio.addSource(gameSounds.cardOgg().getSafeUri().asString(), AudioElement.TYPE_OGG);
    cardAudio.addSource(gameSounds.cardWav().getSafeUri().asString(), AudioElement.TYPE_WAV);
    cardAudio.load();
  }
}
项目:risk    文件:SoundResource.java   
private void loadAttackWonAudio() {
  attackWonAudio = Audio.createIfSupported();
  if (attackWonAudio != null) {
    attackWonAudio.addSource(gameSounds.attackWonMp3().getSafeUri().asString(), 
        AudioElement.TYPE_MP3);
    attackWonAudio.addSource(gameSounds.attackWonOgg().getSafeUri().asString(), 
        AudioElement.TYPE_OGG);
    attackWonAudio.addSource(gameSounds.attackWonWav().getSafeUri().asString(), 
        AudioElement.TYPE_WAV);
    attackWonAudio.load();
  }
}
项目:risk    文件:SoundResource.java   
private void loadAttackLostAudio() {
  attackLostAudio = Audio.createIfSupported();
  if (attackLostAudio != null) {
    attackLostAudio.addSource(gameSounds.attackLostMp3().getSafeUri().asString(), 
        AudioElement.TYPE_MP3);
    attackLostAudio.addSource(gameSounds.attackLostOgg().getSafeUri().asString(), 
        AudioElement.TYPE_OGG);
    attackLostAudio.addSource(gameSounds.attackLostWav().getSafeUri().asString(), 
        AudioElement.TYPE_WAV);
    attackLostAudio.load();
  }
}
项目:risk    文件:SoundResource.java   
private void loadGameWonAudio() {
  gameWonAudio = Audio.createIfSupported();
  if (gameWonAudio != null) {
    gameWonAudio.addSource(gameSounds.gameWonMp3().getSafeUri().asString(), 
        AudioElement.TYPE_MP3);
    gameWonAudio.addSource(gameSounds.gameWonOgg().getSafeUri().asString(), 
        AudioElement.TYPE_OGG);
    gameWonAudio.addSource(gameSounds.gameWonWav().getSafeUri().asString(), 
        AudioElement.TYPE_WAV);
    gameWonAudio.load();
  }
}
项目:risk    文件:SoundResource.java   
private void loadAddUnitsAudio() {
  addUnitsAudio = Audio.createIfSupported();
  if (addUnitsAudio != null) {
    addUnitsAudio.addSource(gameSounds.addUnitsMp3().getSafeUri().asString(), 
        AudioElement.TYPE_MP3);
    addUnitsAudio.addSource(gameSounds.addUnitsOgg().getSafeUri().asString(), 
        AudioElement.TYPE_OGG);
    addUnitsAudio.addSource(gameSounds.addUnitsWav().getSafeUri().asString(), 
        AudioElement.TYPE_WAV);
    addUnitsAudio.load();
  }
}
项目:LanguageMemoryApp    文件:AudioPlayer.java   
private void createPlayer() throws AudioException {
    audioPlayer = Audio.createIfSupported();
    if (audioPlayer == null) {
        throw new AudioException("audio not supportered");
    }
    final AudioElement audioElement = audioPlayer.getAudioElement();
    onEndedSetup(audioElement);
}
项目:Peergos    文件:SoundEffects.java   
/**
 * Prefetch the error sound.
 */
public void prefetchError() {
  if (isSupported && error == null) {
    error = Audio.createIfSupported();
    error.addSource("audio/error.ogg", AudioElement.TYPE_OGG);
    error.addSource("audio/error.mp3", AudioElement.TYPE_MP3);
    error.addSource("audio/error.wav", AudioElement.TYPE_WAV);
    prefetchAudio(error);
  }
}
项目:swarm    文件:SoundEffects.java   
/**
 * Prefetch the error sound.
 */
public void prefetchError() {
  if (isSupported && error == null) {
    error = Audio.createIfSupported();
    error.addSource("audio/error.ogg", AudioElement.TYPE_OGG);
    error.addSource("audio/error.mp3", AudioElement.TYPE_MP3);
    error.addSource("audio/error.wav", AudioElement.TYPE_WAV);
    prefetchAudio(error);
  }
}
项目:empiria.player    文件:ReAttachAudioUtil.java   
private NodeList<Node> getSourceNodes(Audio audio) {
    AudioElement audioElement = audio.getAudioElement();
    return audioElement.getChildNodes();
}
项目:GwtAL    文件:WebALContext.java   
public native void bufferData(WebALBuffer buffer, AudioElement audio, boolean streaming) /*-{
    this.bufferData(buffer, audio, streaming);
}-*/;
项目:GwtAL    文件:WebALContext.java   
public native void bufferData(WebALBuffer buffer, JsArray<AudioElement> audioArray, boolean streaming) /*-{
    this.bufferData(buffer, audioArray, streaming);
}-*/;