當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。