MediaPlayer setOnBufferingUpdateListener - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for MediaPlayer setOnBufferingUpdateListener method.

This code example shows how to use the following methods:setOnBufferingUpdateListener, setOnCompletionListener, start
		return duration;
	} 
 
	public void onPrepared(MediaPlayer mPlayer) {
		if (isPlaying) {
			mPlayer.setOnCompletionListener(this);
			mPlayer.setOnBufferingUpdateListener(new OnBufferingUpdateListener()
			{ 
				public void onBufferingUpdate(MediaPlayer mPlayer, int percent)
				{ 
					/* TODO: call back, e.g. update outer progress bar */ 
					Log.d("AudioOnBufferingUpdate", "percent: " + percent); 
				} 
			}); 
			mPlayer.start();
		} 
	} 
 
	public boolean onError(MediaPlayer mPlayer, int arg1, int arg2) {
		Log.e("AUDIO onError", "error " + arg1 + " " + arg2);
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setAudioStreamType, setOnBufferingUpdateListener, setOnCompletionListener, setOnErrorListener, setOnPreparedListener
This code example shows how to use the following methods:setOnBufferingUpdateListener, setOnCompletionListener, start
		return duration;
	} 
 
	public void onPrepared(MediaPlayer mPlayer) {
		if (isPlaying) {
			mPlayer.setOnCompletionListener(this);
			mPlayer.setOnBufferingUpdateListener(new OnBufferingUpdateListener()
			{ 
				public void onBufferingUpdate(MediaPlayer mPlayer, int percent)
				{ 
					/* TODO: call back, e.g. update outer progress bar */ 
					Log.d("AudioOnBufferingUpdate", "percent: " + percent); 
				} 
			}); 
			mPlayer.start();
		} 
	} 
 
	public boolean onError(MediaPlayer mPlayer, int arg1, int arg2) {
		Log.e("AUDIO onError", "error " + arg1 + " " + arg2);
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:prepare, setAudioStreamType, setDataSource, setDisplay, setOnBufferingUpdateListener
This code example shows how to use the following methods:setOnBufferingUpdateListener, setOnCompletionListener, start
		return duration;
	} 
 
	public void onPrepared(MediaPlayer mPlayer) {
		if (isPlaying) {
			mPlayer.setOnCompletionListener(this);
			mPlayer.setOnBufferingUpdateListener(new OnBufferingUpdateListener()
			{ 
				public void onBufferingUpdate(MediaPlayer mPlayer, int percent)
				{ 
					/* TODO: call back, e.g. update outer progress bar */ 
					Log.d("AudioOnBufferingUpdate", "percent: " + percent); 
				} 
			}); 
			mPlayer.start();
		} 
	} 
 
	public boolean onError(MediaPlayer mPlayer, int arg1, int arg2) {
		Log.e("AUDIO onError", "error " + arg1 + " " + arg2);
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:prepare, setAudioStreamType, setDataSource, setDisplay, setOnBufferingUpdateListener
    } 
     
    private void playVideo() { 
    	try { 
            // Create a new media player and set the listeners 
            mMediaPlayer = new MediaPlayer();
            mMediaPlayer.setDataSource(path);
            mMediaPlayer.setDisplay(holder);
            mMediaPlayer.prepare();
            mMediaPlayer.setOnBufferingUpdateListener(this);
            mMediaPlayer.setOnCompletionListener(this);
            mMediaPlayer.setOnPreparedListener(this);
            mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
    	} catch (Exception e) {
        } 
    } 
     
    public void onPrepared(MediaPlayer mediaplayer) {
        mVideoWidth = mMediaPlayer.getVideoWidth();
        mVideoHeight = mMediaPlayer.getVideoHeight();
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setOnBufferingUpdateListener, setOnCompletionListener, setOnErrorListener, setOnPreparedListener, setOnSeekCompleteListener
This code example shows how to use the following methods:setOnBufferingUpdateListener, setOnCompletionListener, setOnErrorListener, setOnInfoListener, setOnPreparedListener
    public static final String TAG = DefMediaPlayer.class.getName();
 
    private MediaPlayer mMediaPlayer = null;
 
    protected DefMediaPlayer() { 
        mMediaPlayer = new MediaPlayer();
        mMediaPlayer.setOnBufferingUpdateListener(this);
        mMediaPlayer.setOnCompletionListener(this);
        mMediaPlayer.setOnErrorListener(this);
        mMediaPlayer.setOnInfoListener(this);
        mMediaPlayer.setOnPreparedListener(this);
        mMediaPlayer.setOnSeekCompleteListener(this);
        mMediaPlayer.setOnVideoSizeChangedListener(this);
    } 
 
    @Override 
    public long getCurrentPosition() { 
        try { 
            return mMediaPlayer.getCurrentPosition();
        } catch (IllegalStateException e) {
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setOnBufferingUpdateListener, setOnPreparedListener
	 
	protected Stream mCurrentStream;
	 
	public MusicManager(ServiceManager manager){
		mSvcMan = manager;
		mPlayer = new MediaPlayer();
		mPlayer.setOnBufferingUpdateListener(this);
		mPlayer.setOnPreparedListener(this);
		mCurrentStream = null;
	} 
	 
	public synchronized void stop(){ 
		if (mCurrentStream != null){
			mPlayer.reset();
			mCurrentStream = null;
		} 
	} 
	 
	public synchronized void play(Stream stream) throws IOException {
		if (mCurrentStream != null){
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setOnBufferingUpdateListener, setOnCompletionListener, start
		return duration;
	} 
 
	public void onPrepared(MediaPlayer mPlayer) {
		if (isPlaying) {
			mPlayer.setOnCompletionListener(this);
			mPlayer.setOnBufferingUpdateListener(new OnBufferingUpdateListener()
			{ 
				public void onBufferingUpdate(MediaPlayer mPlayer, int percent)
				{ 
					/* TODO: call back, e.g. update outer progress bar */ 
					Log.d("AudioOnBufferingUpdate", "percent: " + percent); 
				} 
			}); 
			mPlayer.start();
		} 
	} 
 
	public boolean onError(MediaPlayer mPlayer, int arg1, int arg2) {
		Log.e("AUDIO onError", "error " + arg1 + " " + arg2);
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related MediaPlayer setOnBufferingUpdateListener Questions & Answers:

setOnBufferingUpdateListener Method Overview
Register a callback to be invoked when the status of a network stream's buffer has changed.
See Code Examples for other Android MediaPlayer Methods: