示例#1
0
        public void StartRecording(ExportVideoDTO exportVideo)
        {
            _record   = true;
            _settings = exportVideo;

            switch (exportVideo.VideoType)
            {
            case VideoType.MP4:
                _mediaRecorder = new MP4Recorder(exportVideo.Width, exportVideo.Height, exportVideo.Framerate, AudioSettings.outputSampleRate, (int)AudioSettings.speakerMode, OnStopRecording);
                break;

            case VideoType.GIF:
                _mediaRecorder = new GIFRecorder(exportVideo.Width, exportVideo.Height, exportVideo.Framerate, OnStopRecording);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            _clock       = new RealtimeClock();
            _cameraInput = new CameraInput(_mediaRecorder, _clock, _camera);
            _audioInput  = new AudioInput(_mediaRecorder, _clock, AudioPeerService.GetAudioListener());

            _mainCanvas.gameObject.SetActive(false);
            _recordCanvas.gameObject.SetActive(true);

            AudioPeerService.Stop();
            AudioPeerService.Play();
            _coroutine = StartCoroutine(_Play());
        }
示例#2
0
 private void OnValidateClicked(ExportVideoDTO exportVideo)
 {
     RecordingService.StartRecording(exportVideo);
 }