Exemplo n.º 1
0
        public static void Pause()
        {
            switch (Interface)
            {
            case NatCamInterface.NativeInterface:
                Native.Pause();
                break;

            case NatCamInterface.FallbackInterface:
                Fallback.Pause();
                break;
            }
        }
Exemplo n.º 2
0
        public static void Release()
        {
            DeviceCamera.Reset();
            switch (Interface)
            {
            case NatCamInterface.NativeInterface:
                Native.Release();
                break;

            case NatCamInterface.FallbackInterface:
                Fallback.Release();
                break;
            }
        }
Exemplo n.º 3
0
        public static void Play(DeviceCamera camera = null)
        {
            switch (Interface)
            {
            case NatCamInterface.NativeInterface:
                if (camera != null)
                {
                    Native.mActiveCamera = camera;
                }
                Native.Play();
                break;

            case NatCamInterface.FallbackInterface:
                if (camera != null)
                {
                    Fallback.mActiveCamera = camera;
                }
                Fallback.Play();
                break;
            }
        }
Exemplo n.º 4
0
 public static void CapturePhoto(params PhotoCallback[] callbacks)
 {
     if (!IsPlaying)
     {
         Ext.Warn("Cannot capture photo when session is not running");
         return;
     }
     if (callbacks.Length == 0 && OnPhotoCapture == null)
     {
         Ext.Warn("Cannot capture photo because there is no callback subscribed");
         return;
     }
     else if (callbacks.Length > 0)
     {
         for (int i = 0; i < callbacks.Length; i++)
         {
             PhotoCallback callback       = callbacks[i];
             PhotoCallback captureWrapper = null;
             captureWrapper = (Texture2D photo) => {
                 if (callback != null)
                 {
                     callback(photo);
                 }
                 OnPhotoCapture -= captureWrapper;
             };
             OnPhotoCapture += captureWrapper;
         }
     }
     if (Interface == NatCamInterface.NativeInterface)
     {
         Native.CapturePhoto();
     }
     else
     {
         Fallback.CapturePhoto();
     }
 }
Exemplo n.º 5
0
        public static void Initialize(NatCamInterface NatCamInterface = NatCamInterface.NativeInterface, PreviewType PreviewType = PreviewType.NonReadable, Switch MetadataDetection = Switch.Off)
        {
            Interface = NatCamInterface;
            if (Interface == NatCamInterface.NativeInterface && !IsSupportedDevice)
            {
                Ext.Warn("Running on an unsupported platform or a device without cameras. Falling back to Fallback");
                Interface = NatCamInterface.FallbackInterface;
            }
            switch (Interface)
            {
            case NatCamInterface.NativeInterface:
                Native.Initialize(PreviewType, MetadataDetection == Switch.On);
                Native.RegisterEvents(PropagateStart, PropagateUpdate, PropagatePhoto, PropagateBarcode, PropagateFace, SetApplicationFocus);
                break;

            case NatCamInterface.FallbackInterface:
                Fallback.Initialize(MetadataDetection == Switch.On);
                Fallback.RegisterEvents(PropagateStart, PropagateUpdate, PropagatePhoto, PropagateBarcode, PropagateFace, SetApplicationFocus);
                break;

            default:
                goto case NatCamInterface.FallbackInterface;
            }
        }