Exemplo n.º 1
0
 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();
            }

        }
Exemplo n.º 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();
     }
 }
Exemplo n.º 5
0
            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();
                 * }*/
            }
Exemplo n.º 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);
     }
 }
Exemplo n.º 7
0
 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)
     {
     }
 }
Exemplo n.º 8
0
        /// <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();
            }
        }
Exemplo n.º 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;
            }
        }
Exemplo n.º 10
0
        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 ();
					}
				}

			}
Exemplo n.º 13
0
 public override void OnDisconnected(CameraDevice camera)
 {
     recordManager.cameraOpenCloseLock.Release();
     camera.Close();
     recordManager.cameraDevice = null;
 }
Exemplo n.º 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;
 }
Exemplo n.º 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;
 }
Exemplo n.º 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();
 }
Exemplo n.º 22
0
 public override void OnDisconnected(CameraDevice camera)
 {
     Debug.WriteLine("Camera disconnected.");
     camera.Close();
     Camera = null;
 }
Exemplo n.º 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;
		}
Exemplo n.º 25
0
 public override void OnError(CameraDevice camera, CameraError error)
 {
     Debug.WriteLine("Camera error: " + error);
     camera.Close();
     Camera = null;
 }
Exemplo n.º 26
0
 public override void OnDisconnected(CameraDevice cameraDevice)
 {
     owner.mCameraOpenCloseLock.Release();
     cameraDevice.Close();
     owner.mCameraDevice = null;
 }
Exemplo n.º 27
0
 public override void OnDisconnected(CameraDevice camera)
 {
     fragment.cameraOpenCloseLock.Release ();
     camera.Close ();
     fragment.cameraDevice = null;
 }