Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        private async void StartButton_Click(object sender, RoutedEventArgs e)
        {
            if (m_rpcRunning)
            {
                var result = await m_rpcClient.Stop();

                m_rpcRunning         = false;
                startButton.Content  = "Start";
                openButton.IsEnabled = true;
                m_audioOutput.Stop();
                m_audioOutput = null;
            }
            else
            {
                m_audioOutput = new Audio.AudioOutput();
                await m_audioOutput.Start();

                m_rpcClient.Start();
                m_rpcRunning         = true;
                startButton.Content  = "Stop";
                openButton.IsEnabled = false;
            }
        }