protected void lockCamera() {
   if (mUnlocked) {
     Log.d(TAG, "Locking camera");
     try {
       mCamera.reconnect();
     } catch (Exception e) {
       Log.e(TAG, e.getMessage());
     }
     mUnlocked = false;
   }
 }
Exemple #2
0
 private void stopRecording() {
   prMediaRecorder.stop();
   prMediaRecorder.reset();
   try {
     prCamera.reconnect();
   } catch (IOException e) {
     e.printStackTrace();
   }
   btnStartRecorder.setText("Start");
   prRecordInProcess = false;
   prCamera.startPreview();
 }
Exemple #3
0
  public void stopRecording() throws IOException {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
      throw new UnsupportedOperationException("Video recording supported only on API Level 11+");
    }

    MediaRecorder tempRecorder = recorder;

    recorder = null;
    tempRecorder.stop();
    tempRecorder.release();
    camera.reconnect();
    startPreview();
  }
 @Override
 public void onResume() {
   super.onResume();
   if (camera != null) {
     try {
       camera.reconnect();
     } catch (IOException e) {
       e.printStackTrace();
     }
   }
   if (orientationListener == null) {
     initOrientationListener();
   }
   orientationListener.enable();
 }
 private void stopRecording() {
   prMediaRecorder.stop();
   prMediaRecorder.reset();
   try {
     prCamera.reconnect();
   } catch (IOException e) {
     e.printStackTrace();
   }
   Toast.makeText(
           this.getApplicationContext(),
           "Video saved to " + mVideoFileFullPath,
           Toast.LENGTH_SHORT)
       .show();
   prStartBtn.setText("Start");
   prRecordInProcess = false;
   prCamera.startPreview();
 }
  @Override
  public void stopVideoRecording(CameraSession session) throws Exception {
    Descriptor descriptor = (Descriptor) session.getDescriptor();
    Camera camera = descriptor.getCamera();

    if (camera != null) {
      MediaRecorder tempRecorder = recorder;

      recorder = null;
      tempRecorder.stop();
      tempRecorder.release();
      camera.reconnect();
      camera.startPreview();
    }

    getBus().post(new VideoTakenEvent(xact));
    xact = null;
  }
 @Override
 public void reconnect() throws IOException {
   camera.reconnect();
 }