public CameraPreviewU(Context context, CameraU camera) : base(context)
        {
            _context       = context;
            _camera        = camera;
            _surfaceHolder = Holder;

            _surfaceHolder.AddCallback(this);
            //_surfaceHolder.SetType(SurfaceType.PushBuffers);
        }
예제 #2
0
        public CameraU(Context context, string type, Surface sv)
        {
            //Initialize
            Log.Debug(_tag, "Trying to adquire camera's informations...");
            _cameraManager = (CameraManager)context.GetSystemService(Context.CameraService); //Instance of CameraManager
            Log.Debug(_tag, "camera's informations adquired succefully !");

            sa = new Size[10];

            _id = CameraU.getCameraIdFromType(context, type);

            configureStream();

            //Create an Instance pf CameraDeviceStateCallBackU
            cb = new CameraDeviceStateCallBackU(sv, sa[0].Width, sa[0].Height);

            try
            {
                _cameraManager.OpenCamera(_id, cb, null); //Open Camera in function of type (When camera is open, go to callback OnOpened Method)
                if (type == "FRONT")
                {
                    cameraLocation = "FRONTALE";
                }
                else if (type == "BACK")
                {
                    cameraLocation = "ARRIERE";
                }
            }
            catch (CameraAccessException e)
            {
                Log.Error(_tag, "CameraAccessException : " + e.Message);
            }
            catch (SecurityException e)
            {
                Log.Error(_tag, "SecurityException : " + e.Message);
            }
        }
예제 #3
0
 public void OnSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) //When SurfaceTexture is available
 {
     sf       = new Surface(surface);
     _mCamera = new CameraU(this, "FRONT", sf);
     tv.Text  = "La caméra " + _mCamera.cameraLocation + " est ouverte !";
 }