Example #1
0
        private void Update()
        {
            // Press the S key to trigger audio and background color change - useful for testing A/V sync
            if (Input.GetKeyDown(KeyCode.S))
            {
                if (_audioHit != null && _capture.IsCapturing())
                {
                    AudioSource.PlayClipAtPoint(_audioHit, Vector3.zero);
                    Camera.main.backgroundColor = new Color(Random.value, Random.value, Random.value, 0);
                }
            }

            // ESC to stop capture and quit
            if (Input.GetKeyDown(KeyCode.Escape))
            {
                if (_capture != null && _capture.IsCapturing())
                {
                    _capture.StopCapture();
                }
                else
                {
                    Application.Quit();
                }
            }

            // Spin the camera around
            if (_spinCamera && Camera.main != null)
            {
                Camera.main.transform.RotateAround(Vector3.zero, Vector3.up, 20f * Time.deltaTime * _speed);
            }
        }
Example #2
0
        protected void GUI_Controls()
        {
            if (_baseCapture == null)
            {
                return;
            }

            GUILayout.Space(8.0f);

            EditorGUI.BeginDisabledGroup(!Application.isPlaying);
            {
                if (!_baseCapture.IsCapturing())
                {
                    GUI.backgroundColor = Color.green;
                    string startString = "Start Capture";
                    if (!_baseCapture._isRealTime)
                    {
                        startString = "Start Render";
                    }
                    if (GUILayout.Button(startString, GUILayout.Height(32f)))
                    {
                        _baseCapture.SelectCodec(false);
                        _baseCapture.SelectAudioDevice(false);
                        // We have to queue the start capture otherwise Screen.width and height aren't correct
                        _baseCapture.QueueStartCapture();
                    }
                    GUI.backgroundColor = Color.white;
                }
                else
                {
                    GUILayout.BeginHorizontal();
                    if (!_baseCapture.IsPaused())
                    {
                        GUI.backgroundColor = Color.yellow;
                        if (GUILayout.Button("Pause", GUILayout.Height(32f)))
                        {
                            _baseCapture.PauseCapture();
                        }
                    }
                    else
                    {
                        GUI.backgroundColor = Color.green;
                        if (GUILayout.Button("Resume", GUILayout.Height(32f)))
                        {
                            _baseCapture.ResumeCapture();
                        }
                    }
                    GUI.backgroundColor = Color.cyan;
                    if (GUILayout.Button("Cancel", GUILayout.Height(32f)))
                    {
                        _baseCapture.CancelCapture();
                    }
                    GUI.backgroundColor = Color.red;
                    if (GUILayout.Button("Stop", GUILayout.Height(32f)))
                    {
                        _baseCapture.StopCapture();
                    }
                    GUI.backgroundColor = Color.white;
                    GUILayout.EndHorizontal();
                }
            }
            EditorGUI.EndDisabledGroup();

            EditorGUILayout.Space();
            EditorGUI.BeginDisabledGroup(string.IsNullOrEmpty(CaptureBase.LastFileSaved));
            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Browse Last"))
            {
                if (!string.IsNullOrEmpty(CaptureBase.LastFileSaved))
                {
                    Utils.ShowInExplorer(CaptureBase.LastFileSaved);
                }
            }
            {
                Color prevColor = GUI.color;
                GUI.color = Color.cyan;
                if (GUILayout.Button("View Last Capture"))
                {
                    if (!string.IsNullOrEmpty(CaptureBase.LastFileSaved))
                    {
                        Utils.OpenInDefaultApp(CaptureBase.LastFileSaved);
                    }
                }
                GUI.color = prevColor;
            }
            GUILayout.EndHorizontal();
            EditorGUI.EndDisabledGroup();
        }
Example #3
0
 /// <summary>
 /// 结束录像
 /// </summary>
 public void StopCapture()
 {
     movieCapture.StopCapture();
 }
 void stopRecording()
 {
     movieCapture.StopCapture();
     recording = false;
 }