0
 
	private boolean prepareVideoRecorder() { 
 
		// mCamera = getCameraInstance(); 
 
		mMediaRecorder = new MediaRecorder();
 
		// Step 1: Unlock and set camera to MediaRecorder 
		mCamera.unlock();
		mMediaRecorder.setCamera(mCamera);
 
		// Step 2: Set sources 
		mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER);
		mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
 
		// Step 3: Set a CamcorderProfile (requires API Level 8 or higher) 
		mMediaRecorder.setProfile(CamcorderProfile
				.get(CamcorderProfile.QUALITY_LOW));
		mMediaRecorder.setOrientationHint(90);
		// Step 4: Set output file 
		most_recent_video_filename = getOutputMediaFile(MEDIA_TYPE_VIDEO)
				.toString();
		mMediaRecorder.setOutputFile(most_recent_video_filename);
 
		// Step 5: Set the preview output 
		mMediaRecorder.setPreviewDisplay(mPreview.getHolder().getSurface());
 
		// Step 6: Prepare configured MediaRecorder 
		try { 
			mMediaRecorder.prepare();
		} catch (IllegalStateException e) {
			Log.d(TAG,
					"IllegalStateException preparing MediaRecorder: " 
							+ e.getMessage());
			releaseMediaRecorder(); 
			return false; 
		} catch (IOException e) {
			Log.d(TAG, "IOException preparing MediaRecorder: " + e.getMessage());
			releaseMediaRecorder(); 
			return false; 
		} 
		return true; 
	} 
 
	@Override 
	protected void onPause() { 
		super.onPause(); 
		releaseMediaRecorder(); // if you are using MediaRecorder, release it 
								// first 
		releaseCamera(); // release the camera immediately on pause event 
	} 
 
	private void releaseMediaRecorder() { 
		if (mMediaRecorder != null) {
			mMediaRecorder.reset(); // clear recorder configuration
			mMediaRecorder.release(); // release the recorder object
			mMediaRecorder = null;
			mCamera.lock(); // lock camera for later use
		} 
	}