void Update()
 {
     if (Input.GetKeyUp(startCapture))
     {
         bool pending = false;
         // check if still processing
         foreach (VideoCapture videoCapture in videoCaptureManager.videoCaptures)
         {
             if (videoCapture.status == CaptureStatus.STOPPED ||
                 videoCapture.status == CaptureStatus.PENDING)
             {
                 pending = true;
                 break;
             }
         }
         if (pending)
         {
             return;
         }
         videoCaptureManager.StartCapture();
     }
     else if (Input.GetKeyUp(stopCapture))
     {
         videoCaptureManager.StopCapture();
     }
     else if (Input.GetKeyUp(cancelCapture))
     {
         videoCaptureManager.CancelCapture();
     }
 }
        private void OnGUI()
        {
            if (GUI.Button(new Rect(Screen.width - 160, Screen.height - 60, 150, 50), "Browse"))
            {
                // Open video save directory
                Utils.BrowseFolder(videoCaptureManager.saveFolder);
            }
            bool stopped = false;
            bool pending = false;

            // check if still processing
            foreach (VideoCapture videoCapture in videoCaptureManager.videoCaptures)
            {
                if (videoCapture.status == CaptureStatus.STOPPED)
                {
                    stopped = true;
                    break;
                }
                if (videoCapture.status == CaptureStatus.PENDING)
                {
                    pending = true;
                    break;
                }
            }
            if (stopped)
            {
                if (GUI.Button(new Rect(10, Screen.height - 60, 150, 50), "Encoding"))
                {
                    // Waiting processing end
                }
                return;
            }
            if (pending)
            {
                if (GUI.Button(new Rect(10, Screen.height - 60, 150, 50), "Muxing"))
                {
                    // Waiting processing end
                }
                return;
            }
            if (videoCaptureManager.captureStarted)
            {
                if (GUI.Button(new Rect(10, Screen.height - 60, 150, 50), "Stop Capture"))
                {
                    videoCaptureManager.StopCapture();
                }
                if (GUI.Button(new Rect(170, Screen.height - 60, 150, 50), "Cancel Capture"))
                {
                    videoCaptureManager.CancelCapture();
                }
            }
            else
            {
                if (GUI.Button(new Rect(10, Screen.height - 60, 150, 50), "Start Capture"))
                {
                    videoCaptureManager.StartCapture();
                }
            }
        }