title: Android Camera Server Died and Camera Error - 100
body: <p>I'm facing Camera error 100 while testing my android application, I have found some topics on <code>StackOverflow</code> but they were not so helpful. I'm searching for a relevant solution to fix the error.</p>
  
  <p>Code that I've written:</p>
  
  <pre><code>mrec = new MediaRecorder();  // Works well
  
  mCamera = Camera.open();
  mCamera.unlock();
  
  mrec.setCamera(mCamera);
  mrec.setVideoSource(MediaRecorder.VideoSource.CAMERA);
  mrec.setAudioSource(MediaRecorder.AudioSource.MIC); 
  
  mrec.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH));
  
  mrec.setOutputFile("/sdcard/zzzz.3gp");
  
  mrec.prepare();
  mrec.start(); 
  </code></pre>
  
  <p>Code to record Camera :</p>
  
  <pre><code>protected void startRecordingVideo() throws IOException 
  {
  camera = Camera.open();
  camera.unlock();
  SimpleDateFormat timeStampFormat = new SimpleDateFormat(
          "yyyy-MM-dd-HH.mm.ss");
  String fileName = "video_" + timeStampFormat.format(new Date())
          + ".3gp";
  String fileURL = "/sdcard/"+fileName;
  surfaceView = (SurfaceView) findViewById(R.id.surface_camera);
  surfaceHolder = surfaceView.getHolder();
  surfaceHolder.addCallback(this);
  surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
  mrec = new MediaRecorder();
  
  mrec.setCamera(camera);
  
  mrec.setPreviewDisplay(surfaceHolder.getSurface());
  mrec.setVideoSource(MediaRecorder.VideoSource.CAMERA);
      mrec.setAudioSource(MediaRecorder.AudioSource.MIC); 
      mrec.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_LOW));
      mrec.setPreviewDisplay(surfaceHolder.getSurface());
      mrec.setOutputFile("/sdcard/"+fileName); 
  
      mrec.prepare();
      mrec.start();
  }
  
  protected void stopRecordingVideo() {
  mrec.stop();
  mrec.release();
  camera.release();
  }
  
  private void releaseMediaRecorder(){
  if (mrec != null) {
      mrec.reset();   // clear recorder configuration
      mrec.release(); // release the recorder object
      mrec = null;
      camera.lock();           
    }
  }
  
  private void releaseCamera(){
  if (camera != null){
      camera.release();        
      camera = null;
  }
  }
  
  @Override
  public void surfaceChanged(SurfaceHolder holder, int format, int width,
      int height) {
  // TODO Auto-generated method stub
  }
  
  
  @Override
  public void surfaceCreated(SurfaceHolder holder) {
  // TODO Auto-generated method stub
  
  if (camera != null){
      Parameters params = camera.getParameters();
      camera.setParameters(params);
  }
  else {
      Toast.makeText(getApplicationContext(), "Camera not available!", Toast.LENGTH_LONG).show();
      finish();
  }
  }
  
  
  @Override
  public void surfaceDestroyed(SurfaceHolder holder) {
  releaseMediaRecorder();
  camera.stopPreview();
  camera.release();
  
  
  }
  </code></pre>
  
  <p>Here are the Logcat output :</p>
  
  <pre><code>12-27 17:52:02.788: W/IMediaDeathNotifier(21434): media server died!
  12-27 17:52:02.788: W/Camera(21434): Camera server died!
  12-27 17:52:02.788: W/Camera(21434): ICamera died
  12-27 17:52:03.048: E/Camera(21434): Error 100  
  </code></pre>