List of usage examples for com.google.gwt.dom.client AudioElement TYPE_OGG
String TYPE_OGG
To view the source code for com.google.gwt.dom.client AudioElement TYPE_OGG.
Click Source Link
From source file:com.google.gwt.sample.mobilewebapp.client.ui.SoundEffects.java
License:Apache License
/** * Prefetch the error sound./* w w w. jav a 2 s. c o m*/ */ 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); } }
From source file:net.cbtltd.client.field.MediaControl.java
/** * Sets the ID of an audio object.//from ww w . java 2s . c o m * * @param value the new ID of the audio object. */ public void setAudioValue(String value) { Log.debug("setAudioValue " + value); try { this.value = value; if (media == null || value == null || value.isEmpty()) { return; } else if (MediaElement.CAN_PLAY_PROBABLY.equals(media.canPlayType(AudioElement.TYPE_WAV))) { media.setSrc(HOSTS.rootUrl() + HasUrls.AUDIO_DIRECTORY + value + Text.AUDIO_WAV); } else if (MediaElement.CAN_PLAY_PROBABLY.equals(media.canPlayType(AudioElement.TYPE_MP3))) { media.setSrc(HOSTS.rootUrl() + HasUrls.AUDIO_DIRECTORY + value + Text.AUDIO_MP3); } else if (MediaElement.CAN_PLAY_PROBABLY.equals(media.canPlayType(AudioElement.TYPE_OGG))) { media.setSrc(HOSTS.rootUrl() + HasUrls.AUDIO_DIRECTORY + value + Text.AUDIO_OGG); } else if (MediaElement.CAN_PLAY_MAYBE.equals(media.canPlayType(AudioElement.TYPE_WAV))) { media.setSrc(HOSTS.rootUrl() + HasUrls.AUDIO_DIRECTORY + value + Text.AUDIO_WAV); } else if (MediaElement.CAN_PLAY_MAYBE.equals(media.canPlayType(AudioElement.TYPE_MP3))) { media.setSrc(HOSTS.rootUrl() + HasUrls.AUDIO_DIRECTORY + value + Text.AUDIO_MP3); } else if (MediaElement.CAN_PLAY_MAYBE.equals(media.canPlayType(AudioElement.TYPE_OGG))) { media.setSrc(HOSTS.rootUrl() + HasUrls.AUDIO_DIRECTORY + value + Text.AUDIO_OGG); } else { return; } media.load(); //media.setPreload(MediaElement.PRELOAD_AUTO); Log.debug("loaded " + value); } catch (Exception x) { Log.error( "setAudioValue " + HOSTS.rootUrl() + HasUrls.AUDIO_DIRECTORY + value + "\n" + media.getError()); } }
From source file:nl.mpi.tg.eg.experiment.client.service.AudioPlayer.java
License:Open Source License
public AudioPlayer(AudioExceptionListner audioExceptionListner, SafeUri ogg, SafeUri mp3, boolean autoPlay) throws AudioException { this.audioExceptionListner = audioExceptionListner; this.autoPlay = autoPlay; try {/*from w w w . ja va 2 s. c o m*/ createPlayer(); if (ogg != null) { final SourceElement sourceElement = audioPlayer.addSource(ogg.asString(), AudioElement.TYPE_OGG); onNoFoundSetup(sourceElement); } if (mp3 != null) { final SourceElement sourceElement = audioPlayer.addSource(mp3.asString(), AudioElement.TYPE_MP3); onNoFoundSetup(sourceElement); } //audioPlayer.setCurrentTime(0); // on android the if the ready state is not correct then this will fail and audio will not play audioPlayer.load(); // audioPlayer.pause(); } catch (AudioException audioException) { audioExceptionListner.audioExceptionFired(audioException); } }