Code example for Camera

Methods: unlock

0
	private void initRecorder(Surface surface) throws IOException {
		// It is very important to unlock the camera before doing setCamera 
		// or it will results in a black preview 
		if(mCamera == null) {
			mCamera = Camera.open();
			mCamera.unlock();
		} 
 
		if(mMediaRecorder == null)
			mMediaRecorder = new MediaRecorder();
		mMediaRecorder.setPreviewDisplay(surface);
		mMediaRecorder.setCamera(mCamera);
		 
		mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
		mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT);
		File file = new File(Environment.getExternalStorageDirectory(),VIDEO_PATH_NAME);
		// "touch" the file 
		if(!file.exists()) {
			File parent = file.getParentFile();
			if(parent != null) 
				if(!parent.exists())