예제 #1
0
        public static string GetCam(CameraManager _manager, Video.CAMERA_POSITION pos)
        {
            string desiredCameraId = null;

            foreach (string cameraId in _manager.GetCameraIdList())
            {
                CameraCharacteristics chars = _manager.GetCameraCharacteristics(cameraId);
                //List < CameraCharacteristics.Key <?>> keys = chars.getKeys();
                try
                {
                    if ((int)chars.Get(CameraCharacteristics.LensFacing) == ((pos == Video.CAMERA_POSITION.REAR)?(int)LensFacing.Back:(int)LensFacing.Front))
                    {
                        // This is the one we want.
                        desiredCameraId = cameraId;
                        return(desiredCameraId);
                    }
                }
                catch (IllegalArgumentException)
                {
                    // This key not implemented, which is a bit of a pain. Either guess - assume the first one
                    // is rear, second one is front, or give up.
                }
            }
            return(_manager.GetCameraIdList()[0]);
        }
예제 #2
0
 public Camera2Fragment(Video.CAMERA_POSITION camera)
 {
     CURRENTCAMERA = camera;
     ORIENTATIONS.Append((int)SurfaceOrientation.Rotation0, 90);
     ORIENTATIONS.Append((int)SurfaceOrientation.Rotation90, 0);
     ORIENTATIONS.Append((int)SurfaceOrientation.Rotation180, 270);
     ORIENTATIONS.Append((int)SurfaceOrientation.Rotation270, 180);
     surfaceTextureListener = new MySurfaceTextureListener(this);
     stateListener          = new MyCameraStateCallback(this);
 }
예제 #3
0
        public static Camera2Fragment newInstance(Video.CAMERA_POSITION camera)
        {
            var fragment = new Camera2Fragment(camera);

            return(fragment);
        }