uses
sgcP2P;
var
oRTC: TsgcRTCPeerConnection;
begin
oRTC := TsgcRTCPeerConnection.Create(nil);
oRTC.RTCOptions.ICEServers.AddURL('stun:stun.l.google.com:19302');
oRTC.OnLocalDescription := OnLocalDescriptionHandler;
oRTC.OnICECandidate := OnICECandidateHandler;
oRTC.OnConnectionStateChange := OnConnectionStateChangeHandler;
oRTC.OnDataChannel := OnDataChannelHandler;
oRTC.CreateDataChannel('chat');
oRTC.CreateOffer;
end;
procedure TForm1.OnLocalDescriptionHandler(Sender: TObject;
const aType, aSDP: string);
begin
end;
procedure TForm1.OnDataChannelHandler(Sender: TObject;
aChannel: TsgcRTCDataChannel);
begin
aChannel.OnMessage := OnChannelMessageHandler;
aChannel.Send('hello');
end;
TsgcRTCPeerConnection *oRTC = new TsgcRTCPeerConnection(NULL);
oRTC->RTCOptions->ICEServers->AddURL("stun:stun.l.google.com:19302");
oRTC->OnLocalDescription = OnLocalDescriptionHandler;
oRTC->OnICECandidate = OnICECandidateHandler;
oRTC->OnConnectionStateChange = OnConnectionStateChangeHandler;
oRTC->OnDataChannel = OnDataChannelHandler;
oRTC->CreateDataChannel("chat");
oRTC->CreateOffer();
void __fastcall TForm1::OnLocalDescriptionHandler(TObject *Sender,
const String aType, const String aSDP)
{
}
void __fastcall TForm1::OnDataChannelHandler(TObject *Sender,
TsgcRTCDataChannel *aChannel)
{
aChannel->OnMessage = OnChannelMessageHandler;
aChannel->Send("hello");
}