示例#1
0
 /// <summary>
 /// Stops the active camera.
 /// </summary>
 public override void Stop()
 {
     if (hasInitDone)
     {
         NatCam.Pause();
     }
 }
示例#2
0
 /// <summary>
 /// Pause this instance.
 /// </summary>
 public void Pause()
 {
     if (NatCam.IsPlaying)
     {
         NatCam.Pause();
     }
 }
示例#3
0
    private void ActivateCamera(CameraFacing facing)
    {
        if (!initialized)
        {
            return;
        }

        // Any spray compositing that happens while the camera is initializing should spray pitch black.
        activeTexture       = Texture2D.blackTexture;
        staleFramesReceived = 0;

        var device = (facing == CameraFacing.Front) ? DeviceCamera.FrontCamera : DeviceCamera.RearCamera;

        if (device != null)
        {
            // We can't change the resolution while the preview is playing.
            if (NatCam.IsPlaying)
            {
                NatCam.Pause();
            }

            NatCam.ActiveCamera     = device;
            NatCam.OnPreviewStart  += OnPreviewStart;
            NatCam.OnPreviewUpdate += OnPreviewUpdate;

            NatCam.ActiveCamera.SetFramerate(deviceCameraFramerate);
            NatCam.ActiveCamera.SetResolution(deviceCameraResolution);

            // The exposure and focus modes are only available on the native interface.
            if (NatCam.Interface == NatCamInterface.NativeInterface)
            {
                NatCam.ActiveCamera.FocusMode    = deviceCameraFocusMode;
                NatCam.ActiveCamera.ExposureMode = deviceCameraExposureMode;
            }

            NatCam.Play();

            if (FacingChanged != null)
            {
                FacingChanged(facing);
            }
        }
        else if (Debug.isDebugBuild)
        {
            Debug.LogError("CameraCapture: no camera for this orientation");
        }
    }
        public void SetActive(bool active)
        {
            /*
             * if (active == NatCam.IsPlaying)
             *  return;
             */

            if (active)
            {
                NatCam.Play();
                IsPlaying = true;
            }
            else
            {
                NatCam.Pause();
                IsPlaying = false;
            }
        }
示例#5
0
 /// <summary>
 /// Raises the stop button click event.
 /// </summary>
 public void OnStopButtonClick()
 {
     NatCam.Pause();
 }
示例#6
0
 /// <summary>
 /// Raises the pause button click event.
 /// </summary>
 public void OnPauseButtonClick()
 {
     NatCam.Pause();
 }
示例#7
0
 public override void StopCameraPreview()
 {
     NatCam.Pause();
 }