public void AddFrame() { if (encoder != null && isRecording) { encoder.AddFrame(videoInput.GetFrame()); videoInput.EndFrame(); #if UNITY_2018_1_OR_NEWER if (recorder.recordAudio) { audioInput.StartFrame(); encoder.AddSamples(audioInput.GetBuffer()); audioInput.EndFrame(); } #endif currentFrame++; } }
IEnumerator RecordFrame() { yield return(new WaitForEndOfFrame()); if (encoder != null && isRecording) { if (recorder.recordAudio) { audioInput.StartFrame(); } encoder.AddFrame(videoInput.GetFrame()); videoInput.EndFrame(); if (recorder.recordAudio) { encoder.AddSamples(audioInput.GetBuffer()); audioInput.EndFrame(); } } }