WebRTC
Peer-to-peer real-time communication for audio, video, and data. Build video conferencing, voice calls, and low-latency data channels directly in your Delphi applications.
Peer-to-peer real-time communication for audio, video, and data. Build video conferencing, voice calls, and low-latency data channels directly in your Delphi applications.
WebRTC (Web Real-Time Communication) enables direct peer-to-peer connections between devices for streaming audio, video, and arbitrary data.
WebRTC eliminates the need for media servers by establishing direct connections between peers. Using STUN and TURN servers for NAT traversal and ICE for connectivity checks, WebRTC finds the optimal path between two endpoints. sgcWebSockets provides a complete WebRTC stack including signaling, peer connection management, SDP negotiation, and data channels — all from native Delphi code.
A complete WebRTC stack for native Delphi applications.
Full NAT traversal support with STUN for address discovery, TURN for relay fallback, and ICE for optimal connectivity path selection.
Manage peer connections with full lifecycle support: creation, offer/answer negotiation, ICE candidate exchange, and graceful teardown.
Exchange arbitrary data between peers with configurable reliability, ordering, and priority. Perfect for chat, file transfer, and gaming.
Session Description Protocol negotiation for establishing media sessions. Automatic codec negotiation and capability matching.
Stream audio and video between peers with support for multiple tracks, codec negotiation, and adaptive bitrate control.
Share screen content with remote peers for presentations, remote support, and collaborative work sessions.
Real-time communication scenarios powered by WebRTC.
Build multi-party video conferencing applications with low latency and high-quality audio and video streams.
Implement VoIP calling with crystal-clear audio, echo cancellation, and noise suppression built into the protocol.
Transfer files directly between peers without server intermediaries, ensuring privacy and reducing bandwidth costs.
Build multiplayer games with ultra-low-latency data channels for game state synchronization and voice chat.
Stream live audio and video content to audiences with minimal delay compared to traditional streaming protocols.
Set up a peer connection and exchange data in native Delphi code.
uses
sgcWebRTC_Client, sgcP2P_Client, sgcSTUN_Classes;
var
P2PClient: TsgcP2PClient;
procedure TForm1.FormCreate(Sender: TObject);
begin
P2PClient := TsgcP2PClient.Create(nil);
// Configure STUN server for NAT traversal
P2PClient.STUNServer.Host := 'stun.l.google.com';
P2PClient.STUNServer.Port := 19302;
// Configure TURN server as relay fallback
P2PClient.TURNServer.Host := 'turn.example.com';
P2PClient.TURNServer.Port := 3478;
P2PClient.TURNServer.Username := 'user';
P2PClient.TURNServer.Password := 'password';
// Set up event handlers
P2PClient.OnP2PConnect := OnP2PConnect;
P2PClient.OnP2PMessage := OnP2PMessage;
P2PClient.OnP2PDisconnect := OnP2PDisconnect;
end;
procedure TForm1.ButtonConnectClick(Sender: TObject);
begin
// Connect to signaling server and create peer connection
P2PClient.Host := 'signaling.example.com';
P2PClient.Port := 443;
P2PClient.Connect;
end;
procedure TForm1.OnP2PConnect(Sender: TObject;
aPeerId: string);
begin
// Peer connected, send a data channel message
P2PClient.SendMessage(aPeerId, 'Hello from Delphi!');
end;
procedure TForm1.OnP2PMessage(Sender: TObject;
aPeerId, aMessage: string);
begin
Memo1.Lines.Add('Peer ' + aPeerId + ': ' + aMessage);
end;
Deep-link to the component reference, grab the ready-to-run demo project, and download the trial.