Android MediaPlayer.OnCompletionListener - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android MediaPlayer.OnCompletionListener class.

This code example shows how to use the following methods:onCompletion
        public void onCompletion(MediaPlayer mp) { 
            if (mMediaController != null) { 
                mMediaController.hide(); 
            } 
            if (mOnCompletionListener != null) { 
                mOnCompletionListener.onCompletion(mMediaPlayer); 
            } 
        } 
    }; 
 
    private MediaPlayer.OnErrorListener mErrorListener =
        new MediaPlayer.OnErrorListener() { 
        public boolean onError(MediaPlayer mp, int framework_err, int impl_err) { 
            Log.d(TAG, "Error: " + framework_err + "," + impl_err); 
            if (mMediaController != null) { 
                mMediaController.hide(); 
            } 
 
            if (mOnErrorListener != null) { 
                if (mOnErrorListener.onError(mMediaPlayer, framework_err, impl_err)) { 
3
CodeRank
This code example shows how to use the following methods:onCompletion
            mTargetState = STATE_PLAYBACK_COMPLETED; 
            if (mMediaController != null) { 
                mMediaController.hide(); 
            } 
            if (mOnCompletionListener != null) { 
                mOnCompletionListener.onCompletion(mMediaPlayer); 
            } 
        } 
    }; 
 
    private MediaPlayer.OnErrorListener mErrorListener =
        new MediaPlayer.OnErrorListener() { 
        public boolean onError(MediaPlayer mp, int framework_err, int impl_err) { 
            Log.d(TAG, "Error: " + framework_err + "," + impl_err); 
            mCurrentState = STATE_ERROR; 
            mTargetState = STATE_ERROR; 
            if (mMediaController != null) { 
                mMediaController.hide(); 
            } 
 
5
CodeRank
This code example shows how to use the following methods:onCompletion
        public void onCompletion(MediaPlayer mp) { 
            if (mMediaController != null) { 
                mMediaController.hide(); 
            } 
            if (mOnCompletionListener != null) { 
                mOnCompletionListener.onCompletion(mMediaPlayer); 
            } 
        } 
    }; 
 
    private MediaPlayer.OnErrorListener mErrorListener =
        new MediaPlayer.OnErrorListener() { 
        public boolean onError(MediaPlayer mp, int a, int b) { 
            Log.d("VideoView", "Error: " + a + "," + b); 
            if (mMediaController != null) { 
                mMediaController.hide(); 
            } 
 
            /* If an error handler has been supplied, use it and finish. */ 
            if (mOnErrorListener != null) { 
3
CodeRank
This code example shows how to use the following methods:onCompletion
        public void onCompletion(MediaPlayer mp) { 
            if (mMediaController != null) { 
                mMediaController.hide(); 
            } 
            if (mOnCompletionListener != null) { 
                mOnCompletionListener.onCompletion(mMediaPlayer); 
            } 
        } 
    }; 
 
    private MediaPlayer.OnErrorListener mErrorListener =
        new MediaPlayer.OnErrorListener() { 
        public boolean onError(MediaPlayer mp, int framework_err, int impl_err) { 
            Log.d(TAG, "Error: " + framework_err + "," + impl_err); 
            if (mMediaController != null) { 
                mMediaController.hide(); 
            } 
 
            /* If an error handler has been supplied, use it and finish. */ 
            if (mOnErrorListener != null) { 
3
CodeRank
This code example shows how to use the following methods:onCompletion
 
				@Override 
				public void onCompletion(MediaPlayer mp) {
					// TODO Auto-generated method stub 
					if(ocl != null)
						ocl.onCompletion(mPlayer);
					if(mPlayer != null){
						mPlayer.stop();
						mPlayer.release();
					} 
					modePlay = STANDBY;
				} 
			}); 
	        mPlayer.setOnPreparedListener(new OnPreparedListener() {
				@Override 
				public void onPrepared(MediaPlayer mp) {
					if (onRecordStartPlayingListener != null)
						onRecordStartPlayingListener.onStart();
					mPlayer.start();
 
3
CodeRank
This code example shows how to use the following methods:onCompletion
 
				@Override 
				public void onCompletion(MediaPlayer mp) {
					// TODO Auto-generated method stub 
					if (ocl != null)
						ocl.onCompletion(mediaPlayer);
					if (mediaPlayer != null) {
						mediaPlayer.stop();
						mediaPlayer.release();
					} 
					mode = MODE_STANDBY;
				} 
			}); 
 
			Log.d("BackgroundMusic", "Start opening:" + filename);
			if (filename.startsWith(DEFAULT_MUSICS_FOLDER_PATH)) {
				Log.d("BackgroundMusic", "in folder:" + filename);
				// mediaPlayer.setDataSource(filename); 
				// MediaPlayer mPlayer = new MediaPlayer(); 
				// example of mediaFile 
3
CodeRank
This code example shows how to use the following methods:onCompletion
                                    public void onClick(DialogInterface dialog, int whichButton) { 
                                        /* If we get here, there is no onError listener, so 
                                         * at least inform them that the video is over. 
                                         */ 
                                        if (mOnCompletionListener != null) { 
                                            mOnCompletionListener.onCompletion(mMediaPlayer); 
                                        } 
                                    } 
                                }) 
                        .setCancelable(false) 
                        .show(); 
            } 
            return true; 
        } 
    }; 
 
    private MediaPlayer.OnBufferingUpdateListener mBufferingUpdateListener =
        new MediaPlayer.OnBufferingUpdateListener() { 
        public void onBufferingUpdate(MediaPlayer mp, int percent) { 
            mCurrentBufferPercentage = percent; 
4
CodeRank
This code example shows how to use the following methods:onCompletion
  public void onCompletion(MediaPlayer paramMediaPlayer)
  { 
    this.mCurrentState = 7;
    this.mStatusListener.completed();
    if (this.mOnCompletionListener != null)
      this.mOnCompletionListener.onCompletion(paramMediaPlayer);
    if (this.mCurrentState != 10)
      releaseWakeLock(); 
  } 
 
  public boolean onError(MediaPlayer paramMediaPlayer, int paramInt1, int paramInt2)
  { 
    this.mCurrentState = 8;
    this.mStatusListener.error();
    if (this.mOnErrorListener != null);
    for (boolean bool = this.mOnErrorListener.onError(paramMediaPlayer, paramInt1, paramInt2); ; bool = false)
      return bool;
  } 
 
  public void onPrepared(MediaPlayer paramMediaPlayer)
4
CodeRank
This code example shows how to use the following methods:onCompletion
 
	private MediaPlayer.OnCompletionListener mCompletionListener = new MediaPlayer.OnCompletionListener() {
		 
		public void onCompletion(MediaPlayer mp) { 
			if (mOnCompletionListener != null) { 
				mOnCompletionListener.onCompletion(mMediaPlayer); 
			} 
			mp.seekTo(0); 
			mp.start(); 
		} 
	}; 
 
	private MediaPlayer.OnErrorListener mErrorListener = new MediaPlayer.OnErrorListener() {
	 
		public boolean onError(MediaPlayer mp, int framework_err, int impl_err) { 
			if (mOnErrorListener != null) { 
				if (mOnErrorListener.onError(mMediaPlayer, framework_err, impl_err)) { 
					return true; 
				} 
			} 
4
CodeRank
This code example shows how to use the following methods:onCompletion
		public void onCompletion(MediaPlayer mp) { 
			if (mMediaController != null) { 
				mMediaController.hide(); 
			} 
			if (mOnCompletionListener != null) { 
				mOnCompletionListener.onCompletion(mMediaPlayer); 
			} 
		} 
	}; 
 
	private MediaPlayer.OnErrorListener mErrorListener = new MediaPlayer.OnErrorListener() {
		public boolean onError(MediaPlayer mp, int framework_err, int impl_err) { 
			if (mMediaController != null) { 
				mMediaController.hide(); 
			} 
 
			if (mOnErrorListener != null) { 
				if (mOnErrorListener.onError(mMediaPlayer, framework_err, 
						impl_err)) { 
					return true; 
4
CodeRank

Related Android MediaPlayer.OnCompletionListener Questions & Answers:

Other Android MediaPlayer.OnCompletionListener Examples

141:				mp = MediaPlayer.create(MainActivity.this, R.raw.light_switch_on);
142:			}
143:			mp.setOnCompletionListener(new OnCompletionListener() {
144:	
145:	            @Override

Read More

17:	
18:	public class AndroidBuildingMusicPlayerActivity extends Activity implements OnCompletionListener, SeekBar.OnSeekBarChangeListener {
19:	
20:		private ImageButton btnPlay;
21:		private ImageButton btnForward;

Read More

See Code Examples for Android MediaPlayer.OnCompletionListener Methods: