WindowsPhone.Conference.WebRTC.Signalling.Detach C# (CSharp) Method

Detach() public method

public Detach ( Action callback ) : void
callback Action
return void
        public void Detach(Action<string> callback)
        {
            if (UseWebSyncExtension)
            {
                // Leave the managed WebSync channel.
                WebSyncClient.LeaveConference(new LeaveConferenceArgs("/" + SessionId)
                {
                    OnSuccess = (e) =>
                    {
                        Conference = null;
                        SessionId = null;

                        callback(null);
                    },
                    OnFailure = (e) =>
                    {
                        callback(string.Format("Could not detach signalling from conference {0}. {1}", SessionId, e.Exception.Message));
                    }
                });
            }
            else
            {
                // Unsubscribe from the WebSync channel.
                WebSyncClient.Unsubscribe(new UnsubscribeArgs("/" + SessionId)
                {
                    OnSuccess = (e) =>
                    {
                        // Detach our event handlers.
                        Conference.OnLinkOfferAnswer -= SendOfferAnswer;
                        Conference.OnLinkCandidate -= SendCandidate;
                        WebSyncClient.OnNotify -= ReceiveOfferAnswerOrCandidate;

                        Conference = null;
                        SessionId = null;

                        callback(null);
                    },
                    OnFailure = (e) =>
                    {
                        callback(string.Format("Could not detach signalling from conference {0}. {1}", SessionId, e.Exception.Message));
                    }
                });
            }
        }
    }

Usage Example

Ejemplo n.º 1
0
        public void StopConference(Action <string> callback)
        {
            // Detach signalling from the conference.
            Signalling.Detach((error) =>
            {
                Conference.OnLinkInit -= LogLinkInit;
                Conference.OnLinkUp   -= LogLinkUp;
                Conference.OnLinkDown -= LogLinkDown;
                Conference             = null;

                VideoStream.OnLinkInit -= AddRemoteVideoControl;
                VideoStream.OnLinkDown -= RemoveRemoteVideoControl;
                VideoStream             = null;

                AudioStream = null;

                callback(error);
            });
        }