Code example for MediaPlayer.OnErrorListener

Methods: onError

0
 
	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; 
				} 
			} 
			return true; 
		} 
	}; 
 
	/** 
	 * Register a callback to be invoked when the media file is loaded and ready 
	 * to go. 
	 *  
	 * @param l The callback that will be run 
	 */ 
	public void setOnPreparedListener(MediaPlayer.OnPreparedListener l) {
		mOnPreparedListener = l;