MediaRecorder release - 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 release method.

This code example shows how to use the following methods:release, stop
	protected void stopRecording(){ 
		try{ 
			if((recorder != null)&&(isRecording))
			{ 
				isRecording = false;
				recorder.stop();
		        recorder.release(); 
			} 
			moveFile(saveFile);
		} 
		catch (Exception e)
		{ 
			e.printStackTrace();
		} 
	}	 
	 
	protected void startPlaying(String file) {
		if (isPlaying==false) {
			try { 
				mPlayer = new MediaPlayer();
8
CodeRank
This code example shows how to use the following methods:release, reset, stop
		recorder.start();
		isRecording = true;
	} 
 
	public void stop() throws IOException { 
		recorder.stop();
		recorder.reset();
		recorder.release();
		isRecording = false;
	} 
 
	public Uri getPath() {
		return Uri.fromFile(new File(path));
	} 
 
	public boolean isRecording() { 
		return isRecording;
	} 
 
} 
8
CodeRank
This code example shows how to use the following methods:release, stop
	} 
	 
	@Kroll.method 
	public void stop() { 
		if (recorder != null) {
			recorder.stop();
			recorder.release();
			recorder = null;
		} 
	} 
	 
	// Properties 
	@Kroll.getProperty 
	public int getSoundAmplitude() { 
		if (recorder != null) {
			try { 
				// Convert from 16-bit sample value to dBFS 
				return (int)(20.0 * Math.log10((double)recorder.getMaxAmplitude() / 32767.0));
			} catch (RuntimeException e) {
			} 
8
CodeRank
This code example shows how to use the following methods:release
    recorder.setOnInfoListener(this);
  } 
 
  @Override 
  public void onPause() { 
    recorder.release();
    recorder=null;
 
    super.onPause(); 
  } 
 
  @Override 
  public void onCheckedChanged(CompoundButton buttonView,
                               boolean isChecked) {
    if (isChecked) {
      File output=
          new File(
                   Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS),
                   BASENAME);
 
7
CodeRank
This code example shows how to use the following methods:prepare, release, reset, setAudioEncoder, setAudioSource
                setError(SDCARD_ACCESS_ERROR);
                return; 
            } 
        } 
         
        mRecorder = new MediaRecorder();
        mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
        mRecorder.setOutputFormat(outputfileformat);
        mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
        mRecorder.setOutputFile(mSampleFile.getAbsolutePath());
 
        // Handle IOException 
        try { 
            mRecorder.prepare();
        } catch(IOException exception) {
            setError(INTERNAL_ERROR);
            mRecorder.reset();
            mRecorder.release();
            mRecorder = null;
            return; 

7
CodeRank
This code example shows how to use the following methods:release
    recorder.setOnInfoListener(this);
  } 
 
  @Override 
  public void onPause() { 
    recorder.release();
    recorder=null;
 
    super.onPause(); 
  } 
 
  @Override 
  public void onCheckedChanged(CompoundButton buttonView,
                               boolean isChecked) {
    File recording=getOutputFile();
 
    if (isChecked) {
      if (recording.exists()) {
        recording.delete();
      } 
7
CodeRank
This code example shows how to use the following methods:release, stop
    } 
 
    MediaRecorder tempRecorder=recorder;
 
    recorder=null;
    tempRecorder.stop();
    tempRecorder.release();
    camera.reconnect();
  } 
 
  public void autoFocus() { 
    camera.autoFocus(getHost());
  } 
 
  public void cancelAutoFocus() { 
    camera.cancelAutoFocus();
  } 
 
  // based on CameraPreview.java from ApiDemos 
 
7
CodeRank
This code example shows how to use the following methods:release, reset, stop
            releaseCamera(); 
        } 
    } 
     
    public void stop() { 
        mMediaRecorder.stop();
        releaseMediaRecorder(); 
        camera.lock();
        isRecording = false;
        releaseMediaRecorder();       // if you are using MediaRecorder, release it first 
        releaseCamera();              // release the camera immediately on pause event 
    } 
 
	 
    private boolean prepareVideoRecorder(){ 
        mMediaRecorder = new MediaRecorder();
 
        // Step 1: Unlock and set camera to MediaRecorder 
        camera.unlock();
        mMediaRecorder.setCamera(camera);

7
CodeRank
This code example shows how to use the following methods:prepare, release, reset, setPreviewDisplay, start
        myMediaRecorder.setProfile(targetProfile);
    } 
    
    private boolean realyStart() { 
         
        myMediaRecorder.setPreviewDisplay(myCamSHolder.getSurface());
        try { 
        	myMediaRecorder.prepare();
	    } catch (IllegalStateException e) {
	        releaseMediaRecorder();	 
	        Log.d("TEAONLY", "JAVA:  camera prepare illegal error");
            return false; 
	    } catch (IOException e) {
	        releaseMediaRecorder();	     
	        Log.d("TEAONLY", "JAVA:  camera prepare io error");
            return false; 
	    } 
	     
        try { 
            myMediaRecorder.start();

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

Related MediaRecorder release Questions & Answers:

Other MediaRecorder release Examples

57:	    stopButton.setEnabled(false);
58:	    recorder.stop();
59:	    recorder.release();
60:	    addRecordingToMediaLibrary();
61:	  }

Read More

release Method Overview
Releases resources associated with this MediaRecorder object.
See Code Examples for other Android MediaRecorder Methods: