Exemple #1
0
    private void onVideoModeStopped(VideoCaptureResult result)
    {
        CameraStreamHelper.Instance.CloseVideoCapture();
        videoCapture = null;

        Debug.Log("Video Mode Stopped");
    }
Exemple #2
0
        public void StartRecordingAsync(string filename, OnStartedRecordingVideoCallback onStartedRecordingVideoCallback)
        {
            var result = new VideoCaptureResult();

            if (IsRecording)
            {
                result.resultType = CaptureResultType.UnknownError;
                onStartedRecordingVideoCallback?.Invoke(result);
            }
            else
            {
                try
                {
                    var behaviour = m_CaptureContext.GetBehaviour();
                    ((NRRecordBehaviour)behaviour).SetOutPutPath(filename);
                    m_CaptureContext.StartCapture();
                    IsRecording       = true;
                    result.resultType = CaptureResultType.Success;
                    onStartedRecordingVideoCallback?.Invoke(result);
                }
                catch (Exception)
                {
                    result.resultType = CaptureResultType.UnknownError;
                    onStartedRecordingVideoCallback?.Invoke(result);
                    throw;
                }
            }
        }
Exemple #3
0
        public void StopRecordingAsync(OnStoppedRecordingVideoCallback onStoppedRecordingVideoCallback)
        {
            var result = new VideoCaptureResult();

            if (!IsRecording)
            {
                result.resultType = CaptureResultType.UnknownError;
                onStoppedRecordingVideoCallback?.Invoke(result);
            }
            else
            {
                try
                {
                    m_CaptureContext.StopCapture();
                    IsRecording       = false;
                    result.resultType = CaptureResultType.Success;
                    onStoppedRecordingVideoCallback?.Invoke(result);
                }
                catch (Exception)
                {
                    result.resultType = CaptureResultType.UnknownError;
                    onStoppedRecordingVideoCallback?.Invoke(result);
                    throw;
                }
            }
        }
    private void OnStoppedRecordingVideo(VideoCaptureResult result)
    {
        if (result.success)
        {
            Debug.Log("Stopped recording video.");

            SaveMesh();

            SavePoses();

            Debug.Log("Compressing frames...");

            string sInDir   = m_CurrentOutputFramesDirectory;
            string sOutFile = Path.Combine(OutputDirectoryBasePath, string.Format("{0}_frames.zip", m_CurrentRecordingLabel));

#if !UNITY_EDITOR && UNITY_METRO
            Debug.Log("Zipping frames...");
            ZipFile.CreateFromDirectory(sInDir, sOutFile);
            Debug.Log(string.Format("Frames compressed to {0}", sOutFile));
#else
            Debug.LogError("NOTE: Not zipping up any frames in editor mode because ZipFile is only in .NET code");
#endif



            OnRecordingFinalized();
        }
        else
        {
            Debug.LogError("Failed to stop recording video");
        }
    }
Exemple #5
0
            public async Task VideoCaptureAsync(Ruyi.SDK.Overlay.VideoCaptureState arguments, CancellationToken cancellationToken)
            {
                await OutputProtocol.WriteMessageBeginAsync(new TMessage("VideoCapture", TMessageType.Call, SeqId), cancellationToken);

                var args = new VideoCaptureArgs();

                args.Arguments = arguments;

                await args.WriteAsync(OutputProtocol, cancellationToken);

                await OutputProtocol.WriteMessageEndAsync(cancellationToken);

                await OutputProtocol.Transport.FlushAsync(cancellationToken);

                var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken);

                if (msg.Type == TMessageType.Exception)
                {
                    var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken);

                    await InputProtocol.ReadMessageEndAsync(cancellationToken);

                    throw x;
                }

                var result = new VideoCaptureResult();
                await result.ReadAsync(InputProtocol, cancellationToken);

                await InputProtocol.ReadMessageEndAsync(cancellationToken);

                return;
            }
Exemple #6
0
            public async Task VideoCapture_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken)
            {
                var args = new VideoCaptureArgs();
                await args.ReadAsync(iprot, cancellationToken);

                await iprot.ReadMessageEndAsync(cancellationToken);

                var result = new VideoCaptureResult();

                try
                {
                    await _iAsync.VideoCaptureAsync(args.Arguments, cancellationToken);

                    await oprot.WriteMessageBeginAsync(new TMessage("VideoCapture", TMessageType.Reply, seqid), cancellationToken);

                    await result.WriteAsync(oprot, cancellationToken);
                }
                catch (TTransportException)
                {
                    throw;
                }
                catch (Exception ex)
                {
                    Console.Error.WriteLine("Error occurred in processor:");
                    Console.Error.WriteLine(ex.ToString());
                    var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, " Internal error.");
                    await oprot.WriteMessageBeginAsync(new TMessage("VideoCapture", TMessageType.Exception, seqid), cancellationToken);

                    await x.WriteAsync(oprot, cancellationToken);
                }
                await oprot.WriteMessageEndAsync(cancellationToken);

                await oprot.Transport.FlushAsync(cancellationToken);
            }
 void OnVideoModeStopped(VideoCaptureResult result)
 {
     if (result.success == false)
     {
         Debug.LogWarning("Could not stop video mode.");
         return;
     }
 }
Exemple #8
0
        public void StopVideoModeAsync(OnVideoModeStoppedCallback onVideoModeStoppedCallback)
        {
            m_CaptureContext.StopCaptureMode();
            var result = new VideoCaptureResult();

            result.resultType = CaptureResultType.Success;
            onVideoModeStoppedCallback?.Invoke(result);
        }
        static private VideoCaptureResult MakeCaptureResult(CaptureResultType resultType, long hResult)
        {
            VideoCaptureResult result = new VideoCaptureResult();

            result.resultType = resultType;
            result.hResult    = hResult;

            return(result);
        }
 public void StopVideoModeAsync(OnVideoModeStoppedCallback onVideoModeStoppedCallback)
 {
     if (onVideoModeStoppedCallback != null)
     {
         var result = new VideoCaptureResult();
         result.resultType = CaptureResultType.Success;
         onVideoModeStoppedCallback(result);
     }
 }
Exemple #11
0
        public void StartVideoModeAsync(CameraParameters setupParams, OnVideoModeStartedCallback onVideoModeStartedCallback)
        {
            setupParams.camMode         = CamMode.VideoMode;
            setupParams.hologramOpacity = 1;
            m_CaptureContext.StartCaptureMode(setupParams);
            var result = new VideoCaptureResult();

            result.resultType = CaptureResultType.Success;
            onVideoModeStartedCallback?.Invoke(result);
        }
    void OnVideoModeStarted(VideoCaptureResult result)
    {
        if (result.success == false)
        {
            Debug.LogWarning("Could not start video mode.");
            return;
        }

        Debug.Log("Video capture started.");
    }
Exemple #13
0
    void OnVideoModeStarted(VideoCaptureResult result)
    {
        if (result.success == false)
        {
            print("Could not start video mode.");
            return;
        }

        print("Video capture started.");
    }
 public void StartVideoModeAsync(CameraParameters setupParams, AudioState audioState, OnVideoModeStartedCallback onVideoModeStartedCallback)
 {
     m_RecordBehaviour.SetConfigration(setupParams);
     if (onVideoModeStartedCallback != null)
     {
         var result = new VideoCaptureResult();
         result.resultType = CaptureResultType.Success;
         onVideoModeStartedCallback(result);
     }
 }
Exemple #15
0
    void OnVideoModeStoped(VideoCaptureResult result)
    {
        if (result.success == false)
        {
            print("Could not stop video mode.");
        }

        print("Video mode stopped.");
        _videoCapture.Dispose();
    }
    private void OnVideoModeStopped(VideoCaptureResult result)
    {
        if (result.success)
        {
            Debug.Log("Stopped video mode");

            _processingCameraFrames = false;
        }
        else
        {
            Debug.LogError("Failed to stop video mode");
        }
    }
Exemple #17
0
        private void OnVideoModeStarted(VideoCaptureResult result)
        {
            switch (VideoMode)
            {
            case Mode.LISTENER:
                VideoCapture.FrameSampleAcquired += OnFrameSampleAcquiredListener;
                VideoModeStartedCallback?.Invoke(result);
                break;

            case Mode.POLLING:
                VideoModeStartedCallback?.Invoke(result);
                VideoCapture.RequestNextFrameSample(OnFrameSampleAcquiredPolling);
                break;
            }
        }
    private void OnVideoModeStarted(VideoCaptureResult result)
    {
        if (result.success == false)
        {
            Debug.LogError("Could not start video mode");
            return;
        }

        _processingCameraFrames = true;

        if (_processingCameraFrames)
        {
            this._videoCapture.RequestNextFrameSample(OnFrameSampleAcquired);
        }
    }
Exemple #19
0
        private static VideoCaptureResult MakeCaptureResult(long hResult)
        {
            CaptureResultType  success;
            VideoCaptureResult result = new VideoCaptureResult();

            if (hResult == HR_SUCCESS)
            {
                success = CaptureResultType.Success;
            }
            else
            {
                success = CaptureResultType.UnknownError;
            }
            result.resultType = success;
            result.hResult    = hResult;
            return(result);
        }
        static private VideoCaptureResult MakeCaptureResult(long hResult)
        {
            VideoCaptureResult result = new VideoCaptureResult();

            CaptureResultType resultType;

            if (hResult == HR_SUCCESS)
            {
                resultType = CaptureResultType.Success;
            }
            else
            {
                resultType = CaptureResultType.UnknownError;
            }

            result.resultType = resultType;
            result.hResult    = hResult;

            return(result);
        }
    void OnVideoModeStarted(VideoCaptureResult result)
    {
        if (result.success == false)
        {
            Debug.LogWarning("Could not start video mode.");
            return;
        }

        m_NumFrames          = 0;
        m_RecordingStartTime = Time.time;

        m_CurrentRecordingState = RecordingState.Recording;
        UpdateRecordingUI();

        Debug.Log(string.Format("Started video recording for session {0}", m_CurrentRecordingLabel));

        Debug.Log("Video capture started.");

        if (m_CurrentRecordingState == RecordingState.Recording)
        {
            this._videoCapture.RequestNextFrameSample(OnFrameSampleAcquired);
        }
    }
        public void StartRecordingAsync(string filename, OnStartedRecordingVideoCallback onStartedRecordingVideoCallback)
        {
            if (IsRecording)
            {
                if (onStartedRecordingVideoCallback != null)
                {
                    var result = new VideoCaptureResult();
                    result.resultType = CaptureResultType.UnknownError;
                    onStartedRecordingVideoCallback(result);
                }
                return;
            }
            m_RecordBehaviour.SetOutPutPath(filename);
            m_RecordBehaviour.StartRecord();
            if (onStartedRecordingVideoCallback != null)
            {
                var result = new VideoCaptureResult();
                result.resultType = CaptureResultType.Success;
                onStartedRecordingVideoCallback(result);
            }

            IsRecording = true;
        }
        public void StopRecordingAsync(OnStoppedRecordingVideoCallback onStoppedRecordingVideoCallback)
        {
            if (!IsRecording)
            {
                if (onStoppedRecordingVideoCallback != null)
                {
                    var result = new VideoCaptureResult();
                    result.resultType = CaptureResultType.UnknownError;
                    onStoppedRecordingVideoCallback(result);
                }
                return;
            }

            m_RecordBehaviour.StopRecord();
            if (onStoppedRecordingVideoCallback != null)
            {
                var result = new VideoCaptureResult();
                result.resultType = CaptureResultType.Success;
                onStoppedRecordingVideoCallback(result);
            }

            IsRecording = false;
        }
Exemple #24
0
 private void OnVideoModeStartedCallback(VideoCaptureResult result)
 {
     Task.Run(() => ProcessCamera());
 }
 private static VideoCaptureResult MakeCaptureResult(long hResult)
 {
     CaptureResultType success;
     VideoCaptureResult result = new VideoCaptureResult();
     if (hResult == HR_SUCCESS)
     {
         success = CaptureResultType.Success;
     }
     else
     {
         success = CaptureResultType.UnknownError;
     }
     result.resultType = success;
     result.hResult = hResult;
     return result;
 }
Exemple #26
0
 private void OnVideoModeStopped(VideoCaptureResult result)
 {
     VideoModeStoppedCallback?.Invoke(result);
 }
Exemple #27
0
 private void onVideoModeStopped(VideoCaptureResult result)
 {
     Debug.Log("Video Mode Stopped");
 }