本文整理汇总了Java中com.google.gwt.dom.client.AudioElement类的典型用法代码示例。如果您正苦于以下问题:Java AudioElement类的具体用法?Java AudioElement怎么用?Java AudioElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AudioElement类属于com.google.gwt.dom.client包,在下文中一共展示了AudioElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isSupported
import com.google.gwt.dom.client.AudioElement; //导入依赖的package包/类
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;
}
示例2: setUp
import com.google.gwt.dom.client.AudioElement; //导入依赖的package包/类
@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));
}
示例3: loadDiceAudio
import com.google.gwt.dom.client.AudioElement; //导入依赖的package包/类
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();
}
}
示例4: loadDeployAudio
import com.google.gwt.dom.client.AudioElement; //导入依赖的package包/类
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();
}
}
示例5: loadAttackAudio
import com.google.gwt.dom.client.AudioElement; //导入依赖的package包/类
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();
}
}
示例6: loadCardAudio
import com.google.gwt.dom.client.AudioElement; //导入依赖的package包/类
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();
}
}
示例7: loadAttackWonAudio
import com.google.gwt.dom.client.AudioElement; //导入依赖的package包/类
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();
}
}
示例8: loadAttackLostAudio
import com.google.gwt.dom.client.AudioElement; //导入依赖的package包/类
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();
}
}
示例9: loadGameWonAudio
import com.google.gwt.dom.client.AudioElement; //导入依赖的package包/类
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();
}
}
示例10: loadAddUnitsAudio
import com.google.gwt.dom.client.AudioElement; //导入依赖的package包/类
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();
}
}
示例11: createPlayer
import com.google.gwt.dom.client.AudioElement; //导入依赖的package包/类
private void createPlayer() throws AudioException {
audioPlayer = Audio.createIfSupported();
if (audioPlayer == null) {
throw new AudioException("audio not supportered");
}
final AudioElement audioElement = audioPlayer.getAudioElement();
onEndedSetup(audioElement);
}
示例12: prefetchError
import com.google.gwt.dom.client.AudioElement; //导入依赖的package包/类
/**
* 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);
}
}
示例13: getSourceNodes
import com.google.gwt.dom.client.AudioElement; //导入依赖的package包/类
private NodeList<Node> getSourceNodes(Audio audio) {
AudioElement audioElement = audio.getAudioElement();
return audioElement.getChildNodes();
}
示例14: bufferData
import com.google.gwt.dom.client.AudioElement; //导入依赖的package包/类
public native void bufferData(WebALBuffer buffer, AudioElement audio, boolean streaming) /*-{
this.bufferData(buffer, audio, streaming);
}-*/;
示例15: onEndedSetup
import com.google.gwt.dom.client.AudioElement; //导入依赖的package包/类
private native void onEndedSetup(final AudioElement audioElement) /*-{
var audioPlayer = this;
audioElement.addEventListener("ended", function(){
[email protected].AudioPlayer::onEndedAction()();
}, false);
}-*/;