public void pause() { if (isInPlaybackState()) { if (mMediaPlayer.isPlaying()) { mMediaPlayer.pause(); mCurrentState = STATE_PAUSED; } } mTargetState = STATE_PAUSED; }
@Override public boolean onInfo(MediaPlayer mp, int what, int extra) { Log.d("onInfo: (%d, %d)", what, extra); if (mOnInfoListener != null) { mOnInfoListener.onInfo(mp, what, extra); } else if (mMediaPlayer != null) { if (what == MediaPlayer.MEDIA_INFO_BUFFERING_START) mMediaPlayer.pause(); else if (what == MediaPlayer.MEDIA_INFO_BUFFERING_END) mMediaPlayer.start(); } return true; }
@Override public void pause() { if (mMediaPlayer != null && mIsMediaReadyToBePlayed) { mMediaPlayer.pause(); Intent intent = new Intent(); intent.setAction(ACTION_INFO); intent.putExtra("action", "pause"); if (!isStreaming) intent.putExtra("pos", getCurrentPosition()); sendBroadcast(intent); } else { Log.e(TAG, "MediaPlayer is not instantiated yet."); } }
@Override public boolean onInfo(MediaPlayer arg0, int arg1, int arg2) { switch (arg1) { case MediaPlayer.MEDIA_INFO_BUFFERING_START: if (mListener != null) mListener.onBufferStart(); else mPlayer.pause(); break; case MediaPlayer.MEDIA_INFO_BUFFERING_END: if (mListener != null) mListener.onBufferComplete(); else mPlayer.start(); break; case MediaPlayer.MEDIA_INFO_DOWNLOAD_RATE_CHANGED: if (mListener != null) mListener.onDownloadRateChanged(arg2); break; } return true; }
@Override public void pause() { player.pause(); }
public void stop() { if (mInitialized) { mPlayer.pause(); } }