Example #1
0
        /// <summary>
        /// Leaves the current WebRTC session and Signaling session.
        /// </summary>
        private async Task LeaveSession()
        {
            if (IsInSession)
            {
                try
                {
                    IsFree = false;
                    Logger.LogInformation("Leaving session...");

                    Logger.LogInformation("Closing WebRTC session...");
                    await _webRtcTransporter.DisposeAsync();

                    Logger.LogInformation("Closing Signaling session...");
                    await _signalingTransporter.DisposeAsync();


                    Logger.LogInformation("Session closed!");
                    IsInSession = false;
                }
                catch (Exception ex)
                {
                    Logger.LogError(ex, ex.Message);
                }
                finally
                {
                    IsFree = true;
                }
            }
        }
Example #2
0
        private async void Disconnect()
        {
            if (IsConnected)
            {
                await _transporter?.DisposeAsync();

                ClearConnection();
            }
        }