} //END _CallEvent #endregion #region START RECORDING EVENT //------------------------------------------------------// private void CallStartRecordingMicrophoneEvent() //------------------------------------------------------// { #if NATMIC if( !NatMic.IsRecording ) { if (onRecordingStart != null) { onRecordingStart.Invoke(); } if (ShouldOverlayAudioListenerOverMicrophone() && overlayAudioListener != null) { NatMic.StartRecording( overlayAudioListener, GetAudioFormat(), OnSampleRecieved ); } else if (ShouldOverlayAudioSourceOverMicrophone() && overlayAudioSource != null) { NatMic.StartRecording( overlayAudioSource, GetAudioFormat(), OnSampleRecieved ); } else { NatMic.StartRecording( GetAudioFormat(), OnSampleRecieved ); } } else { Debug.LogError("BlockEventMicrophone.cs CallStartRecordingMicrophoneEvent() ERROR: Microphone is already recording, you can only have one microphone recording event at a time."); } #else Debug.LogError("BlockEventMicrophone.cs CallStartRecordingMicrophoneEvent() ERROR: Unable to begin microphone recording. NATMIC scripting define symbol is missing"); #endif } //END CallStartRecordingMicrophoneEvent
public void StopRecording() { // Stop the microphone NatMic.StopRecording(); // Stop recording cameraRecorder.Dispose(); NatCorder.StopRecording(); }
public void StartRecording() { // Start the microphone var microphoneFormat = Format.Default; NatMic.StartRecording(microphoneFormat, OnSampleBuffer); // Start recording recordingClock = new RealtimeClock(); var audioFormat = new AudioFormat(microphoneFormat.sampleRate, microphoneFormat.channelCount); NatCorder.StartRecording(Container.MP4, VideoFormat.Screen, audioFormat, OnRecording); // Create a camera recorder for the main cam cameraRecorder = CameraRecorder.Create(recordingCamera, recordingClock); }
} //END OnRecordToFileComplete #endif #endregion #region STOP RECORDING EVENT //-------------------------------------------------------// private void CallStopRecordingMicrophoneEvent() //-------------------------------------------------------// { #if NATMIC if(NatMic.IsRecording) { NatMic.StopRecording(); if(onActionCompleted != null) { onActionCompleted.Invoke(); } } #endif } //END CallStopRecordingMicrophoneEvent
public void ToggleRecording(Text buttonText) // Invoked by UI { if (!NatMic.IsRecording) { // Start recording NatMic.StartRecording(Format.Default, OnSampleBuffer); buttonText.text = @"Stop Recording"; } else { // Stop recording NatMic.StopRecording(); buttonText.text = @"Start Recording"; } }