예제 #1
0
    void Update()
    {
        if (_whenRecordingAutoHideUI && !_showUI)
        {
            if (!_movieCapture.IsCapturing())
            {
                _showUI = true;
            }
        }

        if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.F5))
        {
            if (_movieCapture.IsCapturing())
            {
                _movieCapture.StopCapture();
            }
        }

        if (_movieCapture.IsCapturing())
        {
            _lastFileSize       = _movieCapture.GetCaptureFileSize();
            _lastEncodedSeconds = _movieCapture.TotalEncodedSeconds;
            _lastEncodedMinutes = _lastEncodedSeconds / 60;
            _lastEncodedSeconds = _lastEncodedSeconds % 60;
        }
    }
예제 #2
0
    private void Update()
    {
        if (movieCapture.IsCapturing())
        {
            seconds             = movieCapture.TotalEncodedSeconds;//获取录制时长
            minutes             = seconds / 60;
            seconds             = seconds % 60;
            txt_FileLength.text = "录制时长:    " + minutes + " : " + seconds + " 秒";

            fileSize = movieCapture.GetCaptureFileSize();//获取录制文件大小
            float FileSize = ((float)fileSize / (1024f * 1024f));
            txt_FileSize.text = "文件大小:      " + FileSize.ToString("F1") + " MB";
        }
    }
    // Updates 10 times/second
    void OnInspectorUpdate()
    {
        if (_capture != null)
        {
            if (Application.isPlaying)
            {
                _lastFileSize       = _capture.GetCaptureFileSize();
                _lastEncodedSeconds = _capture.TotalEncodedSeconds;
                _lastEncodedMinutes = _lastEncodedSeconds / 60;
                _lastEncodedSeconds = _lastEncodedSeconds % 60;
            }
            else
            {
                StopCapture();
            }
        }
        else
        {
            if (_queueConfigureVideoCodec >= 0)
            {
                int configureVideoCodec = _queueConfigureVideoCodec;
                _queueConfigureVideoCodec = -1;
                AVProMovieCapturePlugin.ConfigureVideoCodec(configureVideoCodec);
            }

            if (_queueConfigureAudioCodec >= 0)
            {
                int configureAudioCodec = _queueConfigureAudioCodec;
                _queueConfigureAudioCodec = -1;
                AVProMovieCapturePlugin.ConfigureAudioCodec(configureAudioCodec);
            }

            if (_queueStart && Application.isPlaying)
            {
                _queueStart = false;
                StartCapture();
            }
        }

        Repaint();
    }