Beispiel #1
0
        public void DidChangeRoute(ARDVideoCallView view)
        {
            var @override = AVAudioSessionPortOverride.None;

            if (_portOvveride == AVAudioSessionPortOverride.None)
            {
                @override = AVAudioSessionPortOverride.Speaker;
            }

            RTCDispatcher.DispatchAsyncOnType(RTCDispatcherQueueType.AudioSession, () =>
            {
                var session = RTCAudioSession.SharedInstance;
                session.LockForConfiguration();
                session.OverrideOutputAudioPort(@override, out NSError error);

                if (error == null)
                {
                    _portOvveride = @override;
                }
                else
                {
                    Console.WriteLine("Error overriding output port:{0}", error.LocalizedDescription);
                }
                session.UnlockForConfiguration();
            });
        }
 private void AudioSessionDidStopPlayOrRecordInternal(RTCAudioSession session)
 {
     // WebRTC is done with the audio session. Restart playback.
     RTCDispatcher.DispatchAsyncOnType(RTCDispatcherQueueType.Main, () =>
     {
         AudioSessionDidStopPlayOrRecord(session);
     });
 }
 public void AudioSessionDidStopPlayOrRecord(RTCAudioSession session)
 {
     // WebRTC is done with the audio session. Restart playback.
     RTCDispatcher.DispatchAsyncOnType(RTCDispatcherQueueType.Main, () =>
     {
         Console.WriteLine("audioSessionDidStopPlayOrRecord");
         RestartAudioPlayerIfNeeded();
     });
 }
 private void AudioSessionDidStartPlayOrRecordInternal(RTCAudioSession session)
 {
     // Stop playback on main queue and then configure WebRTC.
     RTCDispatcher.DispatchAsyncOnType(RTCDispatcherQueueType.Main, () =>
     {
         Console.WriteLine("Setting isAudioEnabled to YES.");
         session.IsAudioEnabled = true;
     });
 }
        public void AudioSessionDidStartPlayOrRecord(RTCAudioSession session)
        {
            // Stop playback on main queue and then configure WebRTC.
            RTCDispatcher.DispatchAsyncOnType(RTCDispatcherQueueType.Main, () =>
            {
                if (_mainView.IsAudioLoopPlaying)
                {
                    Console.WriteLine("Stopping audio loop due to WebRTC start.");
                    _audioPlayer.Stop();
                }

                Console.WriteLine("Setting isAudioEnabled to YES.");
                session.IsAudioEnabled = true;
            });
        }