private void ReleaseMedia()
        {
            try
            {
                if (VideoCapturer != null)
                {
                    VideoCapturer.StopCapture();
                    VideoCapturer = null;
                }

                if (CurrentVideoTrack != null)
                {
                    var videoTrack = CurrentVideoTrack;
                    CurrentVideoTrack = null;
                    CurrentRoom?.LocalParticipant.UnpublishTrack(videoTrack);
                    DropRenderings(videoTrack);
                    videoTrack.Release();
                }

                if (CurrentAudioTrack != null)
                {
                    var audioTrack = CurrentAudioTrack;
                    CurrentAudioTrack = null;
                    CurrentRoom?.LocalParticipant.UnpublishTrack(audioTrack);
                    audioTrack.Enable(false);
                    audioTrack.Release();
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
Пример #2
0
        public void ReleaseMedia()
        {
            try
            {
                if (VideoCapturer != null)
                {
                    VideoCapturer.StopCapture();
                    VideoCapturer = null;
                }

                if (CurrentVideoTrack != null)
                {
                    var videoTrack = CurrentVideoTrack;
                    CurrentVideoTrack = null;
                    CurrentRoom?.LocalParticipant.RemoveVideoTrack(videoTrack);
                    DropRenderers(videoTrack);
                    videoTrack.Release();
                }

                if (CurrentAudioTrack != null)
                {
                    var audioTrack = CurrentAudioTrack;
                    CurrentAudioTrack = null;
                    CurrentRoom?.LocalParticipant.RemoveAudioTrack(audioTrack);
                    audioTrack.Enable(false);
                    audioTrack.Release();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Пример #3
0
 public void ReleaseMedia()
 {
     if (VideoCapturer != null)
     {
         VideoCapturer.StopCapture();
         VideoCapturer = null;
     }
     if (CurrentVideoTrack != null)
     {
         var videoTrack = CurrentVideoTrack;
         CurrentVideoTrack = null;
         CurrentRoom?.LocalParticipant.UnpublishTrack(videoTrack);
         DropRenderers(videoTrack);
         videoTrack.Release();
     }
     if (CurrentAudioTrack != null)
     {
         var audioTrack = CurrentAudioTrack;
         CurrentAudioTrack = null;
         CurrentRoom?.LocalParticipant.UnpublishTrack(audioTrack);
         audioTrack.Enable(false);
         audioTrack.Release();
     }
 }