コード例 #1
0
        /// <summary>
        /// Capture Stop Routine with Unity resource release
        /// </summary>
        public void StopCapture()
        {
            if (captureStarted != screenshotStarted)
            {
                NativeEncoder.fbc_stopCapture();

                if (outputTexture)
                {
                    Destroy(outputTexture);
                    outputTexture = null;
                }

                captureStarted  = false;
                screenshotReady = false;

                captureStartedType = NativeEncoder.CAPTURE_TYPE.NONE;

                Debug.Log("Capture stopped");
            }
        }
コード例 #2
0
 private void OnCaptureStarted(NativeEncoder.CAPTURE_TYPE captureType)
 {
     captureStarted     = true;
     captureStartedType = captureType;
     Debug.Log("Capture started");
 }
コード例 #3
0
        void Awake()
        {
            captureStarted     = false;
            screenshotStarted  = false;
            captureStartedType = NativeEncoder.CAPTURE_TYPE.NONE;

            OnError += CaptureStatusLog;

            // Live video preset
            if (liveVideoPreset == NativeEncoder.RESOLUTION_PRESET._720P)
            {
                liveVideoWidth   = 1280;
                liveVideoHeight  = 720;
                liveVideoBitRate = 2000000;
            }
            else if (liveVideoPreset == NativeEncoder.RESOLUTION_PRESET._1080P)
            {
                liveVideoWidth   = 1920;
                liveVideoHeight  = 1080;
                liveVideoBitRate = 4000000;
            }
            else if (liveVideoPreset == NativeEncoder.RESOLUTION_PRESET._4K)
            {
                liveVideoWidth   = 4096;
                liveVideoHeight  = 2048;
                liveVideoBitRate = 10000000;
            }

            // VOD video preset
            if (vodVideoPreset == NativeEncoder.RESOLUTION_PRESET._720P)
            {
                vodVideoWidth   = 1280;
                vodVideoHeight  = 720;
                vodVideoBitRate = 2000000;
            }
            else if (vodVideoPreset == NativeEncoder.RESOLUTION_PRESET._1080P)
            {
                vodVideoWidth   = 1920;
                vodVideoHeight  = 1080;
                vodVideoBitRate = 4000000;
            }
            else if (vodVideoPreset == NativeEncoder.RESOLUTION_PRESET._4K)
            {
                vodVideoWidth   = 4096;
                vodVideoHeight  = 2048;
                vodVideoBitRate = 10000000;
            }

            // Screenshot video preset
            if (screenshotPreset == NativeEncoder.RESOLUTION_PRESET._720P)
            {
                screenShotWidth  = 1280;
                screenShotHeight = 720;
            }
            else if (screenshotPreset == NativeEncoder.RESOLUTION_PRESET._1080P)
            {
                screenShotWidth  = 1920;
                screenShotHeight = 1080;
            }
            else if (screenshotPreset == NativeEncoder.RESOLUTION_PRESET._4K)
            {
                screenShotWidth  = 4096;
                screenShotHeight = 2048;
            }

            // Preview video preset
            if (previewVideoPreset == NativeEncoder.RESOLUTION_PRESET._720P)
            {
                previewVideoWidth   = 1280;
                previewVideoHeight  = 720;
                previewVideoBitRate = 2000000;
            }
            else if (previewVideoPreset == NativeEncoder.RESOLUTION_PRESET._1080P)
            {
                previewVideoWidth   = 1920;
                previewVideoHeight  = 1080;
                previewVideoBitRate = 4000000;
            }
            else if (previewVideoPreset == NativeEncoder.RESOLUTION_PRESET._4K)
            {
                previewVideoWidth   = 4096;
                previewVideoHeight  = 2048;
                previewVideoBitRate = 10000000;
            }

            // Retrieve attached VR devie for sound and microphone capture in VR
            // If expected VR device is not attached, it will capture default audio device
            string vrDeviceName = UnityEngine.XR.XRDevice.model.ToLower();

            if (vrDeviceName.Contains("rift"))
            {
                attachedHMD = NativeEncoder.VRDEVICE_TYPE.OCULUS_RIFT;
            }
            else if (vrDeviceName.Contains("vive"))
            {
                attachedHMD = NativeEncoder.VRDEVICE_TYPE.HTC_VIVE;
            }
            else
            {
                attachedHMD = NativeEncoder.VRDEVICE_TYPE.UNKNOWN;
            }
        }