public void StopRunning()
        {
            if (activeCamera == null)
            {
                return;
            }

            if (attachment != null)
            {
                attachment.@delegate = default;
                WebCamSourceAttachment.Destroy(attachment.gameObject);
                attachment = default;
            }

            activeCamera.Stop();
        }
        public Task StartRunning(Action startCallback, Action frameCallback)
        {
            var startTask = new TaskCompletionSource <bool>();

            if (activeCamera == null || (activeCamera != null && activeCamera.isPlaying))
            {
                return(startTask.Task);
            }

            this.startCallback = startCallback;
            this.frameCallback = frameCallback;
            firstFrame         = true;
            activeCamera.Play();

            attachment           = new GameObject("NatDeviceWithOpenCVForUnityExample WebCamSource Helper").AddComponent <WebCamSourceAttachment>();
            attachment.@delegate = () => {
                OnFrame();
            };

            startTask.SetResult(true);
            return(startTask.Task);
        }