MediaRecorder setOnErrorListener - top ranked examples from Open Source projects

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

This code example shows how to use the following methods:setOnErrorListener, setOnInfoListener
 
  @Override 
  public void onResume() { 
    super.onResume(); 
 
    recorder=new MediaRecorder();
    recorder.setOnErrorListener(this);
    recorder.setOnInfoListener(this);
  } 
 
  @Override 
  public void onPause() { 
    recorder.release();
    recorder=null;
 
    super.onPause(); 
  } 
 
  @Override 
  public void onCheckedChanged(CompoundButton buttonView,
8
CodeRank
This code example shows how to use the following methods:release, reset, setOnErrorListener, setOnInfoListener
      Log.i(TAG, "starting");
      recorder.start();
    } 
 
    void stop() { 
      recorder.setOnErrorListener(null);
      recorder.setOnInfoListener(null);
      recorder.stop();
      recorder.reset();
      recorder.release();
    } 
  } 
 
  /* 
   * This is null when not recording, and contains the active RecordingState 
   * when recording. 
   */ 
  private RecordingController controller;
 
  public SoundRecorder(final ComponentContainer container) {
6
CodeRank
This code example shows how to use the following methods:release, reset, setOnErrorListener, setOnInfoListener, stop
	private void releaseMediaRecorder() { 
		Log.v(TAG, "Releasing media recorder.");
		if (mMediaRecorder != null) {
			if (mMediaRecorderRecording) {
				try { 
					mMediaRecorder.setOnErrorListener(null);
					mMediaRecorder.setOnInfoListener(null);
					mMediaRecorder.stop();
				} catch (RuntimeException e) {
					Log.e(TAG, "stop fail: " + e.getMessage());
				} 
				mMediaRecorderRecording = false;
			} 
			mMediaRecorder.reset();
			mMediaRecorder.release();
			mMediaRecorder = null;
		} 
	} 
 
	@Override 
6
CodeRank
This code example shows how to use the following methods:setOnErrorListener, setOnInfoListener
 
  @Override 
  public void onResume() { 
    super.onResume(); 
 
    recorder=new MediaRecorder();
    recorder.setOnErrorListener(this);
    recorder.setOnInfoListener(this);
  } 
 
  @Override 
  public void onPause() { 
    recorder.release();
    recorder=null;
 
    super.onPause(); 
  } 
 
  @Override 
  public void onCheckedChanged(CompoundButton buttonView,
7
CodeRank
This code example shows how to use the following methods:release, reset, setOnErrorListener, setOnInfoListener
      Log.i(TAG, "starting");
      recorder.start();
    } 
 
    void stop() { 
      recorder.setOnErrorListener(null);
      recorder.setOnInfoListener(null);
      recorder.stop();
      recorder.reset();
      recorder.release();
    } 
  } 
 
  /* 
   * This is null when not recording, and contains the active RecordingState 
   * when recording. 
   */ 
  private RecordingController controller;
 
  public SoundRecorder(final ComponentContainer container) {
6
CodeRank
This code example shows how to use the following methods:prepare, setAudioEncoder, setAudioSource, setOnErrorListener, setOutputFile
	    if(!state.equals(android.os.Environment.MEDIA_MOUNTED))  
	        throw new IOException("SD Card is not mounted.  It is " + state + ".");
		File directory = new File(path).getParentFile();
		if (!directory.exists() && !directory.mkdirs()) 
			throw new IOException("Path to file could not be created.");	
		_recorder = new MediaRecorder();
		_recorder.setOnErrorListener(new ErrorListener());
		_recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
		_recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
		_recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
		_recorder.setOutputFile(path);
		_recorder.prepare();
		_recorder.start();
	} 
 
	public void stopRecording() { 
		_recorder.stop();
		_recorder.release();
		processaudiofile(); 
	} 
6
CodeRank
This code example shows how to use the following methods:release, reset, setOnErrorListener, setOnInfoListener
      Log.i(TAG, "starting");
      recorder.start();
    } 
 
    void stop() { 
      recorder.setOnErrorListener(null);
      recorder.setOnInfoListener(null);
      recorder.stop();
      recorder.reset();
      recorder.release();
    } 
  } 
 
  /* 
   * This is null when not recording, and contains the active RecordingState 
   * when recording. 
   */ 
  private RecordingController controller;
 
  public SoundRecorder(final ComponentContainer container) {
6
CodeRank
This code example shows how to use the following methods:setAudioSource, setMaxDuration, setOnErrorListener, setOnInfoListener, setOutputFile
	public boolean onOptionsItemSelected(MenuItem item) {
		return (super.onOptionsItemSelected(item));
	} 
 
	private boolean initRecorder() { 
		mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT);
		mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
        CamcorderProfile cpHigh = CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH);
        mMediaRecorder.setProfile(cpHigh);
        mVideoFileName=getOutputMediaFile("mp4").toString();
		mMediaRecorder.setOutputFile(mVideoFileName);
		mMediaRecorder.setMaxDuration(VIDEO_LENGTH);
		mMediaRecorder.setOnInfoListener(this);
		mMediaRecorder.setOnErrorListener(this);
 
		return true; 
	} 
 
    private void prepareRecorder() { 
		mMediaRecorder.setPreviewDisplay(mPreview.getHolder().getSurface());
6
CodeRank
This code example shows how to use the following methods:release, reset, setOnErrorListener, setOnInfoListener
      Log.i(TAG, "starting");
      recorder.start();
    } 
 
    void stop() { 
      recorder.setOnErrorListener(null);
      recorder.setOnInfoListener(null);
      recorder.stop();
      recorder.reset();
      recorder.release();
    } 
  } 
 
  /* 
   * This is null when not recording, and contains the active RecordingState 
   * when recording. 
   */ 
  private RecordingController controller;
 
  public SoundRecorder(final ComponentContainer container) {
6
CodeRank
This code example shows how to use the following methods:release, reset, setOnErrorListener, setOnInfoListener, stop
	private void releaseMediaRecorder() { 
		Log.d(TAG, "Releasing media recorder.");
		if (mMediaRecorder != null) {
			if (mMediaRecorderRecording) {
				try { 
					mMediaRecorder.setOnErrorListener(null);
					mMediaRecorder.setOnInfoListener(null);
					mMediaRecorder.stop();
				} catch (RuntimeException e) {
					Log.e(TAG, "stop fail: " + e.getMessage());
				} 
				mMediaRecorderRecording = false;
			} 
			mMediaRecorder.reset();
			mMediaRecorder.release();
			mMediaRecorder = null;
		} 
		// 
		// if (null != mCameraDevice) { 
		// mCameraDevice.lock(); 

6
CodeRank

Related MediaRecorder setOnErrorListener Questions & Answers:

setOnErrorListener Method Overview
Register a callback to be invoked when an error occurs while recording.
See Code Examples for other Android MediaRecorder Methods: