/// <summary> /// Setup new generic RTCPeerConnection /// </summary> /// <returns></returns> public SpitfireRtc HandleNewPeer() { SpitfireRtc rtcPeerConnection = new SpitfireRtc(); rtcPeerConnection.AddServerConfig(new ServerConfig() { Host = "stun.1.google.com", Port = 19302, Type = ServerType.Stun }); SpitfireRtc.InitializeSSL(); rtcPeerConnection.InitializePeerConnection(); rtcPeerConnection.CreateDataChannel(new DataChannelOptions() { Id = 1, Label = "skeletonChannel", Reliable = false }); rtcPeerConnection.CreateDataChannel(new DataChannelOptions() { Id = 3, Label = "cloudChannel", Reliable = false }); SetupCallbacks(rtcPeerConnection); return(rtcPeerConnection); }
public void BeginLoop(ManualResetEvent go) { //Call this before starting a peer connection SpitfireRtc.InitializeSSL(); Spitfire.AddServerConfig(new ServerConfig { Host = "52.210.97.83", Username = "******", Password = "******", Port = 3478, Type = ServerType.Turn }); //Spitfire.AddServerConfig("turn:52.210.97.83:3478?transport=tcp", "dvw", "helloice1"); var started = Spitfire.InitializePeerConnection(); if (started) { go.Set(); //Keeps the RTC thread alive and active while (!Token.Token.IsCancellationRequested && Spitfire.ProcessMessages(1000)) { Spitfire.ProcessMessages(1000); } //Do cleanup here Console.WriteLine("WebRTC message loop is dead."); } }