private void StopCapture() { if (_movieCapture != null) { _movieCapture.StopCapture(); } }
void Update() { 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); } } 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); } }
void Update() { if (Input.GetKeyDown(KeyCode.Escape)) { if (_capture != null && _capture.IsCapturing()) { _capture.StopCapture(); } else { Application.Quit(); } } // Spin the camera around //Camera.main.transform.RotateAround(Vector3.zero, Vector3.up, 20f * Time.deltaTime * _speed); // Make cubes jump //_timer += Time.deltaTime * _speed; //if (_timer >= 1f) //{ //_timer = 0f; //object[] objs = FindObjectsOfType(typeof(Rigidbody)); //foreach (object o in objs) //{ //((Rigidbody)o).AddForce(Vector3.up * 200f); //} }
private void StopCapture() { if (_capture != null) { if (_capture.IsCapturing()) { _capture.StopCapture(); _lastCapturePath = _capture.LastFilePath; } _capture = null; _captureScene = null; _captureCamera = null; } _audioCapture = null; }
private void recordVideoState(bool flag) { if (flag) { Debug.Log("start record video"); if (_capture != null && !_capture.IsCapturing()) { _capture.StartCapture(); } } else { Debug.Log("stop record video"); if (_capture != null && _capture.IsCapturing()) { _capture.StopCapture(); } } }
void Update() { if (Input.GetKeyDown(KeyCode.S)) { if (_audioHit) { AudioSource.PlayClipAtPoint(_audioHit, Vector3.zero); } Camera.main.backgroundColor = new Color(Random.value, Random.value, Random.value, 0); } if (Input.GetKeyDown(KeyCode.Escape)) { if (_capture != null && _capture.IsCapturing()) { _capture.StopCapture(); } else { Application.Quit(); } } // Spin the camera around Camera.main.transform.RotateAround(Vector3.zero, Vector3.up, 20f * Time.deltaTime * _speed); // Make cubes jump _timer += Time.deltaTime * _speed; if (_timer >= 1f) { _timer = 0f; object[] objs = FindObjectsOfType(typeof(Rigidbody)); foreach (object o in objs) { ((Rigidbody)o).AddForce(Vector3.up * 200f); } } }
private void OnClickBtn(BtnArgs args) { switch (args.Id) { case 0: // 播放 OnClickBtn_Recorde(); break; case 1: // 停止 movieCapture.StopCapture(); txt_FileSize.text = string.Empty; txt_FileLength.text = string.Empty; // TODO 提示文件保存在哪里 Debug.Log("文件已保存至" + filePath); break; case 2: // 暂停 movieCapture.PauseCapture(); break; default: break; } }
private void StopCapture() { _movieCapture.StopCapture(); }
void MyWindow(int id) { GUILayout.BeginVertical(); if (_movieCapture != null) { GUILayout.Label("Resolution:"); GUILayout.BeginHorizontal(); _downScaleIndex = GUILayout.SelectionGrid(_downScaleIndex, _downScales, _downScales.Length); switch (_downScaleIndex) { case 0: _movieCapture._downScale = AVProMovieCaptureBase.DownScale.Original; break; case 1: _movieCapture._downScale = AVProMovieCaptureBase.DownScale.Half; break; case 2: _movieCapture._downScale = AVProMovieCaptureBase.DownScale.Quarter; break; case 3: _movieCapture._downScale = AVProMovieCaptureBase.DownScale.Eighth; break; case 4: _movieCapture._downScale = AVProMovieCaptureBase.DownScale.Sixteenth; break; case 5: _movieCapture._downScale = AVProMovieCaptureBase.DownScale.Specific; break; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(GUILayout.Width(256)); if (_movieCapture._downScale == AVProMovieCaptureBase.DownScale.Specific) { string maxWidthString = GUILayout.TextField(Mathf.FloorToInt(_movieCapture._maxVideoSize.x).ToString(), 4); int maxWidth = 0; if (int.TryParse(maxWidthString, out maxWidth)) { _movieCapture._maxVideoSize.x = Mathf.Clamp(maxWidth, 0, 4096); } GUILayout.Label("x", GUILayout.Width(20)); string maxHeightString = GUILayout.TextField(Mathf.FloorToInt(_movieCapture._maxVideoSize.y).ToString(), 4); int maxHeight = 0; if (int.TryParse(maxHeightString, out maxHeight)) { _movieCapture._maxVideoSize.y = Mathf.Clamp(maxHeight, 0, 4096); } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Frame Rate:"); _frameRateIndex = GUILayout.SelectionGrid(_frameRateIndex, _frameRates, _frameRates.Length); switch (_frameRateIndex) { case 0: _movieCapture._frameRate = AVProMovieCaptureBase.FrameRate.Fifteen; break; case 1: _movieCapture._frameRate = AVProMovieCaptureBase.FrameRate.TwentyFour; break; case 2: _movieCapture._frameRate = AVProMovieCaptureBase.FrameRate.TwentyFive; break; case 3: _movieCapture._frameRate = AVProMovieCaptureBase.FrameRate.Thirty; break; case 4: _movieCapture._frameRate = AVProMovieCaptureBase.FrameRate.Fifty; break; case 5: _movieCapture._frameRate = AVProMovieCaptureBase.FrameRate.Sixty; break; } GUILayout.EndHorizontal(); GUILayout.Space(16f); _movieCapture._isRealTime = GUILayout.Toggle(_movieCapture._isRealTime, "RealTime"); GUILayout.Space(16f); // Video Codec GUILayout.BeginHorizontal(); if (_shownSection != 0) { if (GUILayout.Button("+", GUILayout.Width(24))) { _shownSection = 0; } } else { if (GUILayout.Button("-", GUILayout.Width(24))) { _shownSection = -1; } } GUILayout.Label("Using Video Codec: " + _movieCapture._codecName); if (_movieCapture._codecIndex >= 0 && _videoCodecConfigurable[_movieCapture._codecIndex]) { GUILayout.Space(16f); if (GUILayout.Button("Configure Codec")) { AVProMovieCapturePlugin.ConfigureVideoCodec(_movieCapture._codecIndex); } } GUILayout.EndHorizontal(); if (_videoCodecNames != null && _shownSection == 0) { GUILayout.Label("Select Video Codec:"); _videoPos = GUILayout.BeginScrollView(_videoPos, GUILayout.Height(100)); int newCodecIndex = GUILayout.SelectionGrid(-1, _videoCodecNames, 1) - 1; GUILayout.EndScrollView(); if (newCodecIndex >= -1) { _movieCapture._codecIndex = newCodecIndex; if (_movieCapture._codecIndex >= 0) { _movieCapture._codecName = _videoCodecNames[_movieCapture._codecIndex + 1]; } else { _movieCapture._codecName = "Uncompressed"; } _shownSection = -1; } GUILayout.Space(16f); } _movieCapture._noAudio = !GUILayout.Toggle(!_movieCapture._noAudio, "Record Audio"); GUI.enabled = !_movieCapture._noAudio; // Audio Device GUILayout.BeginHorizontal(); if (_shownSection != 1) { if (GUILayout.Button("+", GUILayout.Width(24))) { _shownSection = 1; } } else { if (GUILayout.Button("-", GUILayout.Width(24))) { _shownSection = -1; } } GUILayout.Label("Using Audio Source: " + _movieCapture._audioDeviceName); GUILayout.EndHorizontal(); if (_audioDeviceNames != null && _shownSection == 1) { GUILayout.Label("Select Audio Source:"); _audioPos = GUILayout.BeginScrollView(_audioPos, GUILayout.Height(100)); int newAudioIndex = GUILayout.SelectionGrid(-1, _audioDeviceNames, 1) - 1; GUILayout.EndScrollView(); if (newAudioIndex >= -1) { _movieCapture._audioDeviceIndex = newAudioIndex; if (_movieCapture._audioDeviceIndex >= 0) { _movieCapture._audioDeviceName = _audioDeviceNames[_movieCapture._audioDeviceIndex + 1]; } else { _movieCapture._audioDeviceName = "Unity"; } _shownSection = -1; } GUILayout.Space(16f); } // Audio Codec GUILayout.BeginHorizontal(); if (_shownSection != 2) { if (GUILayout.Button("+", GUILayout.Width(24))) { _shownSection = 2; } } else { if (GUILayout.Button("-", GUILayout.Width(24))) { _shownSection = -1; } } GUILayout.Label("Using Audio Codec: " + _movieCapture._audioCodecName); if (_movieCapture._audioCodecIndex >= 0 && _audioCodecConfigurable[_movieCapture._audioCodecIndex]) { GUILayout.Space(16f); if (GUILayout.Button("Configure Codec")) { AVProMovieCapturePlugin.ConfigureAudioCodec(_movieCapture._audioCodecIndex); } } GUILayout.EndHorizontal(); if (_audioCodecNames != null && _shownSection == 2) { GUILayout.Label("Select Audio Codec:"); _audioCodecPos = GUILayout.BeginScrollView(_audioCodecPos, GUILayout.Height(100)); int newCodecIndex = GUILayout.SelectionGrid(-1, _audioCodecNames, 1) - 1; GUILayout.EndScrollView(); if (newCodecIndex >= -1) { _movieCapture._audioCodecIndex = newCodecIndex; if (_movieCapture._audioCodecIndex >= 0) { _movieCapture._audioCodecName = _audioCodecNames[_movieCapture._audioCodecIndex + 1]; } else { _movieCapture._audioCodecName = "Uncompressed"; } _shownSection = -1; } GUILayout.Space(16f); } GUI.enabled = true; GUILayout.Space(16f); GUILayout.BeginHorizontal(); GUILayout.Label("Filename Prefix & Ext: "); _movieCapture._autoFilenamePrefix = GUILayout.TextField(_movieCapture._autoFilenamePrefix, 64); _movieCapture._autoFilenameExtension = GUILayout.TextField(_movieCapture._autoFilenameExtension, 8); GUILayout.EndHorizontal(); GUILayout.Space(16f); GUILayout.Space(16f); GUILayout.Label("(Press Esc or CTRL-F5 to stop capture)"); GUILayout.BeginHorizontal(); if (!_movieCapture.IsCapturing()) { if (GUILayout.Button("Start Capture")) { if (_whenRecordingAutoHideUI) { _showUI = false; } _movieCapture.StartCapture(); } } else { if (!_movieCapture.IsPaused()) { if (GUILayout.Button("Pause Capture")) { _movieCapture.PauseCapture(); } } else { if (GUILayout.Button("Resume Capture")) { _movieCapture.ResumeCapture(); } } if (GUILayout.Button("Stop Capture")) { _movieCapture.StopCapture(); } } GUILayout.EndHorizontal(); if (_movieCapture.IsCapturing()) { if (!string.IsNullOrEmpty(_movieCapture.LastFilePath)) { GUILayout.Label("Writing file: '" + System.IO.Path.GetFileName(_movieCapture.LastFilePath) + "'"); } } else { if (!string.IsNullOrEmpty(_movieCapture.LastFilePath)) { GUILayout.Label("Last file written: '" + System.IO.Path.GetFileName(_movieCapture.LastFilePath) + "'"); } } } GUILayout.EndVertical(); }