Android MediaPlayer.OnErrorListener - 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.OnErrorListener class.

This code example shows how to use the following methods:onError
		try { 
			mMediaPlayer.setDataSource(path);
			mMediaPlayer.prepare();
		} catch (Exception e) {
			e.printStackTrace();
			mOnErrorListener.onError(mMediaPlayer, 0, 0);
			return; 
		} 
		mMediaPlayer.start();
		isActive = true;
	} 
 
	public void pause() { 
		mMediaPlayer.pause();
	} 
 
	public void resume() { 
		mMediaPlayer.start();
	} 
 
5
CodeRank
This code example shows how to use the following methods:onError
  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)
  { 
    this.mCurrentState = 3;
    this.mStatusListener.prepared();
    if (this.mOnPreparedListener != null)
      this.mOnPreparedListener.onPrepared(paramMediaPlayer);
  } 
 
  public void pause() 
  { 
    super.pause(); 
4
CodeRank
This code example shows how to use the following methods:onError
			attachMediaController(); 
		} catch (IOException ex) {
			Log.w(TAG, "Unable to open content: " + mUri, ex);
			mCurrentState = STATE_ERROR;
			mTargetState = STATE_ERROR;
			mErrorListener.onError(mMediaPlayer,
					MediaPlayer.MEDIA_ERROR_UNKNOWN, 0);
			return; 
		} catch (IllegalArgumentException ex) {
			Log.w(TAG, "Unable to open content: " + mUri, ex);
			mCurrentState = STATE_ERROR;
			mTargetState = STATE_ERROR;
			mErrorListener.onError(mMediaPlayer,
					MediaPlayer.MEDIA_ERROR_UNKNOWN, 0);
			return; 
		} 
	} 
	/** 
	 * ÉèÖÃϵͳĬÈÏ¿ØÖÆÃæ°å 
	 * @param controller 
3
CodeRank
This code example shows how to use the following methods:onError
				mMediaController.hide(); 
			} 
 
			/* If an error handler has been supplied, use it and finish. */ 
			if (mOnErrorListener != null) { 
				if (mOnErrorListener.onError(mMediaPlayer, framework_err, 
						impl_err)) { 
					return true; 
				} 
			} 
 
			/* 
			 * Otherwise, pop up an error dialog so the user knows that 
			 * something bad has happened. Only try and pop up the dialog if 
			 * we're attached to a window. When we're going away and no longer 
			 * have a window, don't bother showing the user an error. 
			 */ 
			if (getWindowToken() != null) { 
				// Modify by yangguangfu				 
//											  Resources r =  mContext.getResources();  
3
CodeRank
This code example shows how to use the following methods:onError
            attachMediaController(); 
        } catch (IOException ex) {
            Log.w(TAG, "Unable to open content: " + mUri, ex);
            mCurrentState = STATE_ERROR;
            mTargetState = STATE_ERROR;
            mErrorListener.onError(mMediaPlayer, MediaPlayer.MEDIA_ERROR_UNKNOWN, 0);
            return; 
        } catch (IllegalArgumentException ex) {
            Log.w(TAG, "Unable to open content: " + mUri, ex);
            mCurrentState = STATE_ERROR;
            mTargetState = STATE_ERROR;
            mErrorListener.onError(mMediaPlayer, MediaPlayer.MEDIA_ERROR_UNKNOWN, 0);
            return; 
        } 
    } 
 
    public void setMediaController(MediaController controller) {
        if (mMediaController != null) {
            mMediaController.hide();
        } 
3
CodeRank

Related Android MediaPlayer.OnErrorListener Questions & Answers:

See Code Examples for Android MediaPlayer.OnErrorListener Methods: