public void StopRecording() { if (m_audioInput != null) { m_audioInput.Stop(); m_audioInput = null; } if (m_audioOutput != null) { m_audioOutput.Stop(); m_audioOutput = null; } ClearExtendedExecution(); }
public async Task StartRecording() { StopRecording(); m_session = new ExtendedExecutionForegroundSession(); m_session.Reason = ExtendedExecutionForegroundReason.Unconstrained; m_session.Revoked += Session_Revoked; var result = await m_session.RequestExtensionAsync(); if (result != ExtendedExecutionForegroundResult.Allowed) { Utils.Toasts.ShowToast("StartAudioInTheBackground", "Audio EE denied"); return; } m_audioOutput = new Audio.AudioOutput(); m_audioInput = new Audio.AudioInput(); m_audioInput.OnAudioInput += OnAudioInput; await m_audioOutput.Start(); await m_audioInput.Start(); }