public override void EndSession(bool sendBackToRoot, bool showEvaluateCall) { try { if (Session == null && SubscriberKit == null && PublisherKit == null) { return; } lock (_locker) { if (SubscriberKit != null) { SubscriberKit.SubscribeToAudio = false; SubscriberKit.SubscribeToVideo = false; SubscriberKit.Connected -= OnSubscriberConnected; SubscriberKit.StreamDisconnected -= OnSubscriberDisconnected; SubscriberKit.SubscriberDisconnected -= OnSubscriberDisconnected; SubscriberKit.VideoDisabled -= OnSubscriberVideoDisabled; SubscriberKit.VideoEnabled -= OnSubscriberVideoEnabled; SubscriberKit.Dispose(); SubscriberKit = null; } if (PublisherKit != null) { PublisherKit.PublishAudio = false; PublisherKit.PublishVideo = false; PublisherKit.StreamCreated -= OnPublisherStreamCreated; PublisherKit.Dispose(); PublisherKit = null; } if (Session != null) { Session.ConnectionDestroyed -= OnConnectionDestroyed; Session.Connected -= OnDidConnect; Session.StreamReceived -= OnStreamCreated; Session.StreamDropped -= OnStreamDestroyed; Session.Error -= OnError; Session.Signal -= OnSignal; Session.Disconnect(); Session.Dispose(); Session = null; } } ClearPublisherUpdated(); ClearSubscribeUpdated(); _medicalVideoCall.VideoCallStatusAsync((int)CallStatus.Ending, null, sendBackToRoot, showEvaluateCall); } finally { InvitedConnection = null; _medicalVideoCall.Messages.Clear(); IsSessionStarted = false; IsPublishingStarted = false; } }
public override void EndSession() { try { if (Session == null) { return; } lock (_locker) { if (Subscribers?.Count > 0) { foreach (OTSubscriber subscriberKit in Subscribers.Select(subscriber => subscriber.Value)) { subscriberKit.SubscribeToAudio = false; subscriberKit.SubscribeToVideo = false; subscriberKit.DidConnectToStream -= OnSubscriberConnected; subscriberKit.DidDisconnectFromStream -= OnSubscriberDisconnected; subscriberKit.VideoDataReceived -= OnSubscriberVideoDataReceived; subscriberKit.VideoEnabled -= OnSubscriberVideoEnabled; subscriberKit.VideoDisabled -= OnSubscriberVideoDisabled; subscriberKit.Dispose(); } Subscribers = new Dictionary <string, OTSubscriber>(); } if (PublisherKit != null) { PublisherKit.PublishAudio = false; PublisherKit.PublishVideo = false; PublisherKit.StreamCreated -= OnPublisherStreamCreated; PublisherKit.Dispose(); PublisherKit = null; } if (Session != null) { Session.ConnectionDestroyed -= OnConnectionDestroyed; Session.DidConnect -= OnDidConnect; Session.StreamCreated -= OnStreamCreated; Session.StreamDestroyed -= OnStreamDestroyed; Session.DidFailWithError -= OnError; Session.ReceivedSignalType -= OnSignalReceived; Session.Disconnect(); Session.Dispose(); Session = null; } } } finally { IsSessionStarted = false; IsPublishingStarted = false; } }
public override void EndSession() { try { if (Session == null) { return; } lock (_locker) { if (SubscriberKit != null) { SubscriberKit.SubscribeToAudio = false; SubscriberKit.SubscribeToVideo = false; SubscriberKit.DidConnectToStream -= OnSubscriberDidConnectToStream; SubscriberKit.VideoDataReceived -= OnSubscriberVideoDataReceived; SubscriberKit.VideoEnabled -= OnSubscriberVideoEnabled; SubscriberKit.VideoDisabled -= OnSubscriberVideoDisabled; SubscriberKit.Dispose(); SubscriberKit = null; } if (PublisherKit != null) { PublisherKit.PublishAudio = false; PublisherKit.PublishVideo = false; PublisherKit.StreamCreated -= OnPublisherStreamCreated; PublisherKit.Dispose(); PublisherKit = null; } if (Session != null) { Session.ConnectionDestroyed -= OnConnectionDestroyed; Session.DidConnect -= OnDidConnect; Session.StreamCreated -= OnStreamCreated; Session.StreamDestroyed -= OnStreamDestroyed; Session.DidFailWithError -= OnError; Session.ReceivedSignalType -= OnSignalReceived; Session.Disconnect(); Session.Dispose(); Session = null; } } } finally { IsSessionStarted = false; IsPublishingStarted = false; } }