当前位置: 首页>>代码示例>>Java>>正文


Java MediaPlayer.OnCompletionListener方法代码示例

本文整理汇总了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 + "");
    }
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:20,代码来源:PhoeniciaGame.java

示例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);
    }
}
 
开发者ID:Samsung,项目名称:microbit,代码行数:20,代码来源:AlertPlugin.java

示例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);
                }
            }
        });
    }


}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:37,代码来源:TourOverlay.java

示例4: setOnCompletionListener

import android.media.MediaPlayer; //导入方法依赖的package包/类
public void setOnCompletionListener(MediaPlayer.OnCompletionListener l) {
	mOnCompletionListener = l;
}
 
开发者ID:Zhaoss,项目名称:WeiXinRecordedDemo,代码行数:4,代码来源:MyVideoView.java

示例5: setOnCompletionListener

import android.media.MediaPlayer; //导入方法依赖的package包/类
public void setOnCompletionListener(MediaPlayer.OnCompletionListener l) {
  mOnCompletionListener = l;
  if (mVideoView != null) {
    mVideoView.setOnCompletionListener(l);
  }
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:7,代码来源:WXVideoView.java

示例6: setCallBack

import android.media.MediaPlayer; //导入方法依赖的package包/类
public void setCallBack(MediaPlayer.OnCompletionListener callBack) {
    this.callBack = callBack;
}
 
开发者ID:Samsung,项目名称:microbit,代码行数:4,代码来源:PlayAudioPresenter.java

示例7: setOnCompletionListener

import android.media.MediaPlayer; //导入方法依赖的package包/类
public void setOnCompletionListener(
		final MediaPlayer.OnCompletionListener pOnCompletionListener) {
	this.assertNotReleased();

	this.mMediaPlayer.setOnCompletionListener(pOnCompletionListener);
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:7,代码来源:Music.java


注:本文中的android.media.MediaPlayer.OnCompletionListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。