Example #1
0
		private void Peer_PeerConnected (object sender, PeerConnectedEventArgs args)
		{
			using (var h = new Handler (Looper.MainLooper))
				h.Post (() => {
					textView.Text = args.PeerId;
				});
		}
Example #2
0
		//Metod to fire event when the peer is connected
		private void OnPeerConnected (PeerConnectedEventArgs peerConnectedEventArgs)
		{
			PeerConnectedMessageHandler handler = PeerConnected;
			if (handler != null) {
				handler (this, peerConnectedEventArgs);
			}
		}
Example #3
0
		/// <summary>
		/// Handles the message sent by the other peer or the server
		/// </summary>
		/// <param name="message">Message.</param>
		private void HandleMessage (string message)
		{
			ServerMessage serverMessage = JsonConvert.DeserializeObject<ServerMessage> (message);
			switch (serverMessage.Type) {
			//this message comes whent the connection to the sever is opened
			case "OPEN":
				PeerConnectedEventArgs peerConnectedEventArgs = new PeerConnectedEventArgs ();
				peerConnectedEventArgs.PeerId = this.Id;
				OnPeerConnected (peerConnectedEventArgs);
				break;
			//this message comes in when the offer is answered by the other peer. Contains the remote session desciption
			case "ANSWER":
				Negotiator negotiator = Negotiator.GetNegotiator ();
				SessionDescription sessionDescription = new SessionDescription (SessionDescription.Type.Answer, serverMessage.Payload.Sdp.Sdp);
				negotiator.HandleMessage (serverMessage, sessionDescription);
				break;
			}  
		}