本文整理汇总了Java中android.media.MediaPlayer.OnCompletionListener方法的典型用法代码示例。如果您正苦于以下问题:Java MediaPlayer.OnCompletionListener方法的具体用法?Java MediaPlayer.OnCompletionListener怎么用?Java MediaPlayer.OnCompletionListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.media.MediaPlayer
的用法示例。
在下文中一共展示了MediaPlayer.OnCompletionListener方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: playLevelSound
import android.media.MediaPlayer; //导入方法依赖的package包/类
/**
* Play the given audio file
* @param soundFile
*/
public void playLevelSound(String soundFile, MediaPlayer.OnCompletionListener callback) {
Debug.d("Playing sound: "+soundFile);
if (!this.isStarted || !this.isRunning) {
Debug.d("Game hasn't started yet, not playing any sound");
return;
}
if (this.levelSounds.containsKey(soundFile)) {
Music sound = this.levelSounds.get(soundFile);
sound.setOnCompletionListener(callback);
sound.play();
} else {
Debug.d("No levelSounds: " + soundFile + "");
}
}
示例2: addInternalPathForPlaying
import android.media.MediaPlayer; //导入方法依赖的package包/类
private void addInternalPathForPlaying(String rawNameForPlay, MediaPlayer.OnCompletionListener onCompletionListener) {
int playRawIndex = alertTypes.indexOf(AlertType.TYPE_RAW);
final PlayAudioPresenter playAudioPresenter;
if(playRawIndex == -1) {
playAudioPresenter = new PlayAudioPresenter();
} else {
playAudioPresenter = (PlayAudioPresenter) activePresenters.get(playRawIndex);
}
playAudioPresenter.setInternalPathForPlay(rawNameForPlay);
playAudioPresenter.setCallBack(onCompletionListener);
if(playRawIndex == -1) {
activePresenters.add(playAudioPresenter);
alertTypes.add(AlertType.TYPE_RAW);
}
}
示例3: showMessage
import android.media.MediaPlayer; //导入方法依赖的package包/类
public void showMessage(Message message, MessageBox position, final boolean showNextButton, final MediaPlayer.OnCompletionListener listener) {
String messageText = message.text;
String messageSound = message.sound;
this.messageBox.detachChildren();
this.nextButton.setVisible(false);
this.messageBox.attachChild(this.nextButton);
this.positionMessageBox(position);
this.displayText = new Text(this.messageBox.getWidth()/2+16, this.messageBox.getHeight()/2, GameFonts.introText(), messageText, messageText.length(), new TextOptions(HorizontalAlign.LEFT), PhoeniciaContext.vboManager);
this.displayText.setAutoWrapWidth(this.messageBox.getWidth() - 32);
this.displayText.setAutoWrap(AutoWrap.WORDS);
this.messageBox.setHeight(this.displayText.getHeight() + 64);
this.displayText.setPosition(this.messageBox.getWidth() / 2 + 16, this.messageBox.getHeight() - (this.displayText.getHeight() / 2));
this.messageBox.attachChild(this.displayText);
if (messageSound != null && messageSound.length() > 0) {
Debug.d("Playing tour message sound: '" + messageSound + "'");
this.messagePlaying = true;
this.game.playLevelSound(messageSound, new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
messagePlaying = false;
if (listener != null) {
listener.onCompletion(mp);
}
if (showNextButton) {
nextButton.setVisible(true);
}
}
});
}
}
示例4: setOnCompletionListener
import android.media.MediaPlayer; //导入方法依赖的package包/类
public void setOnCompletionListener(MediaPlayer.OnCompletionListener l) {
mOnCompletionListener = l;
}
示例5: setOnCompletionListener
import android.media.MediaPlayer; //导入方法依赖的package包/类
public void setOnCompletionListener(MediaPlayer.OnCompletionListener l) {
mOnCompletionListener = l;
if (mVideoView != null) {
mVideoView.setOnCompletionListener(l);
}
}
示例6: setCallBack
import android.media.MediaPlayer; //导入方法依赖的package包/类
public void setCallBack(MediaPlayer.OnCompletionListener callBack) {
this.callBack = callBack;
}
示例7: setOnCompletionListener
import android.media.MediaPlayer; //导入方法依赖的package包/类
public void setOnCompletionListener(
final MediaPlayer.OnCompletionListener pOnCompletionListener) {
this.assertNotReleased();
this.mMediaPlayer.setOnCompletionListener(pOnCompletionListener);
}