public override void OnError(CameraDevice camera, CameraError error)
 {
     fragment.cameraOpenCloseLock.Release ();
     camera.Close ();
     fragment.cameraDevice = null;
     if (null != fragment.Activity)
         fragment.Activity.Finish ();
 }
		public override void OnError (CameraDevice camera, CameraErrorType error)
		{
			camera.Close ();
			fragment.camera_device = null;
			if (null != fragment.Activity) 
				fragment.Activity.Finish ();

			fragment.opening_camera = false;
		}
        public override void OnError(CameraDevice cameraDevice, CameraError error)
        {
            owner.mCameraOpenCloseLock.Release();
            cameraDevice.Close();
            owner.mCameraDevice = null;
            if (owner == null)
                return;
            Activity activity = owner.Activity;
            if (activity != null)
            {
                activity.Finish();
            }

        }
Beispiel #4
0
 public void Close()
 {
     try
     {
         _cameraOpenCloseLock.Acquire();
         _cameraDevice?.Close();
         _backgroundThread.Stop();
     }
     catch (InterruptedException e)
     {
         throw new RuntimeException("Interrupted while trying to lock camera closing.", e);
     }
     finally
     {
         _cameraOpenCloseLock.Release();
     }
 }
            public override void OnError(CameraDevice camera, Android.Hardware.Camera2.CameraError error)
            {
                Log.Error(TAG, "Received camera device error: " + error);
                lock (_cameraStateLock)
                {
                    _state = STATE_CLOSED;
                    _cameraOpenCloseLock.Release();
                    camera.Close();
                    _cameraDevice = null;
                }

                /*
                 * var activity = Parent;
                 * if (null != activity)
                 * {
                 *  //TODO: clean up parent
                 *  //activity.Finish();
                 * }*/
            }
Beispiel #6
0
 private void CloseCamera()
 {
     try
     {
         if (null != cameraCaptureSession)
         {
             cameraCaptureSession.Close();
             cameraCaptureSession = null;
         }
         if (null != cameraDevice)
         {
             cameraDevice.Close();
             cameraDevice = null;
         }
     }
     catch (InterruptedException e)
     {
         ShowToastMessage("Failed to close camera");
         DebugMessage("ErrorMessage: \n" + e.Message + "\n" + "Stacktrace: \n " + e.StackTrace);
     }
 }
 public void SwitchCamera()
 {
     try
     {
         if (mediaRecorder != null)
         {
             cameraDevice?.Close();
             if (LensFacing == CameraFacing.BACK)
             {
                 openCamera(activity.textureView.Width, activity.textureView.Height, CameraFacing.FRONT);
             }
             else
             {
                 openCamera(activity.textureView.Width, activity.textureView.Height, CameraFacing.BACK);
             }
         }
     }
     catch (System.Exception ex)
     {
     }
 }
        /// <summary>
        /// Closes the current {@link CameraDevice}.
        /// </summary>
        public void CloseCamera()
        {
            try
            {
                _cameraOpenCloseLock.Acquire();
                lock (_cameraStateLock)
                {
                    // Reset state and clean up resources used by the camera.
                    // Note: After calling this, the ImageReaders will be closed after any background
                    // tasks saving Images from these readers have been completed.
                    //mPendingUserCaptures = 0;
                    _state = STATE_CLOSED;
                    if (null != _captureSession)
                    {
                        _captureSession.Close();
                        _captureSession = null;
                    }

                    if (null != _cameraDevice)
                    {
                        _cameraDevice.Close();
                        _cameraDevice = null;
                    }

                    if (null != _yuvImageReader)
                    {
                        _yuvImageReader.Close();
                        _yuvImageReader = null;
                    }
                }
            }
            catch (Java.Lang.InterruptedException e)
            {
                throw new Java.Lang.RuntimeException("Interrupted while trying to lock camera closing.", e);
            }
            finally
            {
                _cameraOpenCloseLock.Release();
            }
        }
Beispiel #9
0
        public static void StopCapture()
        {
            if (_camera != null)
            {
                _camera.Close();
                _camera = null;
            }

            if (_captureSession != null)
            {
                _captureSession.Close();
                _captureSession = null;
            }

            if (_backgroundThread != null)
            {
                _backgroundThread.QuitSafely();
                _backgroundThread.Join();
                _backgroundThread  = null;
                _backgroundHandler = null;
            }
        }
        public override void OnError(CameraDevice cameraDevice, CameraError error)
        {
            Log.Error(TAG, "OnError");

            owner.mCameraOpenCloseLock.Release();
            cameraDevice.Close();
            owner.mCameraDevice = null;

            if (owner == null)
            {
                return;
            }

            //Activity activity = owner.Activity;
            //if (activity != null)
            //{
            //    activity.Finish();
            //}

            if (owner != null)
            {
                owner.Finish();
            }
        }
			public override void OnDisconnected (CameraDevice camera)
			{
				if (Fragment != null) {
					camera.Close ();
					Fragment.mCameraDevice = null;
					Fragment.mOpeningCamera = false;
				}
			}
			public override void OnError (CameraDevice camera, CameraErrorType error)
			{
				camera.Close();
				if (Fragment != null) {
					Fragment.mCameraDevice = null;
					Activity activity = Fragment.Activity;
					Fragment.mOpeningCamera = false;
					if (activity != null) {
						activity.Finish ();
					}
				}

			}
Beispiel #13
0
 public override void OnDisconnected(CameraDevice camera)
 {
     recordManager.cameraOpenCloseLock.Release();
     camera.Close();
     recordManager.cameraDevice = null;
 }
Beispiel #14
0
 public override void OnDisconnected(CameraDevice camera)
 {
     fragment.CameraOpenCloseLock.Release();
     camera.Close();
     fragment.CameraDevice = null;
 }
 public override void OnError(CameraDevice cameraDevice, [GeneratedEnum] CameraError error)
 {
     cameraDevice.Close();
     this._owner.CameraDevice = null;
 }
Beispiel #16
0
 public override void OnDisconnected(CameraDevice camera)
 {
     camera.Close();//throw new NotImplementedException();
 }
 public override void OnDisconnected(CameraDevice cameraDevice)
 {
     owner.mCameraOpenCloseLock.Release();
     cameraDevice.Close();
     owner.mCameraDevice = null;
 }
Beispiel #18
0
 public override void OnError(CameraDevice camera, [GeneratedEnum] CameraError error)
 {
     camera.Close();
     camera = null; //throw new NotImplementedException();
 }
 public override void OnDisconnected(CameraDevice camera)
 {
     camera.Close();
     fragment.camera_device  = null;
     fragment.opening_camera = false;
 }
 public override void OnError(CameraDevice camera, CameraError error)
 {
     Log.Debug(TAG, "Camera device error " + error + ", closing.");
     CameraHandler.CloseCaptureSession();
     camera.Close();
 }
 public override void OnDisconnected(CameraDevice camera)
 {
     Log.Debug(TAG, "Camera disconnected, closing.");
     CameraHandler.CloseCaptureSession();
     camera.Close();
 }
Beispiel #22
0
 public override void OnDisconnected(CameraDevice camera)
 {
     Debug.WriteLine("Camera disconnected.");
     camera.Close();
     Camera = null;
 }
Beispiel #23
0
 public override void OnDisconnected(CameraDevice cameraDevice)
 {
     cameraDevice.Close();
     Owner.mCameraDevice = null;
 }
		public override void OnDisconnected (CameraDevice camera)
		{
			camera.Close ();
			fragment.camera_device = null;
			fragment.opening_camera = false;
		}
Beispiel #25
0
 public override void OnError(CameraDevice camera, CameraError error)
 {
     Debug.WriteLine("Camera error: " + error);
     camera.Close();
     Camera = null;
 }
Beispiel #26
0
 public override void OnDisconnected(CameraDevice cameraDevice)
 {
     owner.mCameraOpenCloseLock.Release();
     cameraDevice.Close();
     owner.mCameraDevice = null;
 }
 public override void OnDisconnected(CameraDevice camera)
 {
     fragment.cameraOpenCloseLock.Release ();
     camera.Close ();
     fragment.cameraDevice = null;
 }