Browser-compatible signaling
CreateOffer, CreateAnswer, SetLocalDescription, SetRemoteDescription and AddIceCandidate build and consume real SDP. Renegotiation, ICE restart and the W3C perfect-negotiation glare rule are built in.
sgcWebRTC is the WebRTC media engine for Delphi and C++ Builder. Add real-time audio and video calls, screen sharing and SCTP data channels to your applications, encrypted with DTLS-SRTP and interoperable with the RTCPeerConnection in any browser. It is compiled Object Pascal calling the operating system's own media APIs, with no WebView and no JavaScript bridge in your process.
Peer-to-peer media and data channels from Delphi: STUN, TURN, ICE and RTCPeerConnection, browser to native. Narrated, with captions. Nothing downloads until you press play.
sgcWebRTC does not add new palette components. It unlocks the rest of the W3C-shaped surface on the same TsgcRTCPeerConnection that ships in sgcWebSockets Enterprise: signaling, connectivity, encryption, data channels and media.
CreateOffer, CreateAnswer, SetLocalDescription, SetRemoteDescription and AddIceCandidate build and consume real SDP. Renegotiation, ICE restart and the W3C perfect-negotiation glare rule are built in.
Trickle or non-trickle ICE gathering against RTCOptions.ICEServers, with server-reflexive candidates from STUN and relayed candidates from TURN when a direct path is blocked.
A DTLS handshake over the nominated ICE pair derives the SRTP keys, and every RTP, RTCP and SCTP packet is encrypted from the first packet. It cannot be turned off for media, the same model a browser enforces.
AddTrack attaches an Opus or G.711 audio track, or a VP8, H.264 or Motion JPEG video track. H.264 uses the platform's hardware encoder: Media Foundation, VideoToolbox or MediaCodec.
CreateDataChannel opens an ordered or unordered, reliable or partially reliable channel (RFC 8831/8832). Send, SendBytes, OnMessage and OnMessageBinary move text and binary payloads.
A delay-based estimator in the style of Google Congestion Control drives the video encoder's target bitrate, backed by RTCP NACK and PLI, RFC 4588 RTX and RED/ULPFEC.
Set an ICE server, hook the SDP and ICE events, open a data channel, then create the offer. The same API in Delphi and C++ Builder.
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'); // forces RTCOptions.DTLS on
oRTC.CreateOffer; // gathers ICE candidates, builds the SDP offer
end;
procedure TForm1.OnLocalDescriptionHandler(Sender: TObject;
const aType, aSDP: string);
begin
// send aType + aSDP to the remote peer over your own signaling channel
end;
procedure TForm1.OnDataChannelHandler(Sender: TObject;
aChannel: TsgcRTCDataChannel);
begin
aChannel.OnMessage := OnChannelMessageHandler;
aChannel.Send('hello');
end;
// includes: sgcP2P.hpp
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"); // forces RTCOptions->DTLS on
oRTC->CreateOffer(); // gathers ICE candidates, builds the SDP offer
void __fastcall TForm1::OnLocalDescriptionHandler(TObject *Sender,
const String aType, const String aSDP)
{
// send aType + aSDP to the remote peer over your own signaling channel
}
void __fastcall TForm1::OnDataChannelHandler(TObject *Sender,
TsgcRTCDataChannel *aChannel)
{
aChannel->OnMessage = OnChannelMessageHandler;
aChannel->Send("hello");
}
That is one side of the exchange. The other side, the signaling relay and the media tracks on top are in the task guide.
Other approaches to WebRTC in Delphi embed a full browser engine and drive its JavaScript stack from Pascal. sgcWebRTC calls the operating system's media APIs directly, which keeps the binary small and lets the same component run where no browser is installed at all.
Standard SDP and the JSEP state machine (RFC 8829) mean a native Delphi or C++ Builder client can call the RTCPeerConnection in a web page, and the other way round.
Two native applications exchange audio, video and data channels directly, with only the signaling passing through your server.
Read the task guide →No embedded Chromium binary means the same component runs on Android and iOS, and in headless services or kiosk devices with no browser installed.
Capture the desktop, a monitor, a window or a region on Windows, cursor included, and stream it as a video track with a data channel alongside.
Native camera and microphone capture backends on Windows, Linux, Apple platforms and Android feed the tracks directly, and renderer backends show the remote video.
Use data channels on their own for chat, telemetry, file transfer or game state, with the reliability and ordering chosen per channel.
sgcWebRTC unlocks the media engine on the TsgcRTCPeerConnection that sgcWebSockets Enterprise already ships with ICE and TURN connectivity. It is not available for Standard or Professional. Every license includes full source code and one year of updates.
The base it builds on: STUN, TURN and ICE clients, the base TsgcRTCPeerConnection, plus WebSocket, HTTP/2, MQTT and the rest of the library.
SDP signaling, DTLS-SRTP, SCTP data channels, audio and video tracks, screen capture and bandwidth estimation. Single, Team and Site licenses.
Every eSeGeCe product for one year, Delphi and .NET, sgcWebSockets Enterprise and sgcWebRTC included, with Premium Support.
The trial installer is per IDE version and already contains the WebRTC components, so there is no separate download.
See sgcWebRTC pricingAudio, video and data channels, encrypted end to end, from the language you already use.
sgcWebRTC sits alongside the components Delphi, C++ Builder, Lazarus and .NET developers already use for networking, signing, web interfaces and APIs.
WebSocket, HTTP/2, MQTT, AMQP, WebRTC, AI and 30+ API integrations for Delphi, C++ Builder, Lazarus and .NET. The Enterprise license sgcWebRTC builds on.
Raw QUIC transport and an HTTP/3 client and server, with WebTransport. An add-on to sgcWebSockets Enterprise.
14 native UI products for Delphi, C++ Builder and .NET: grid, charts, dashboard, planner, maps, PDF and reports.
Server-side HTML and UI components on Bootstrap 5 and htmx for Delphi, C++ Builder and .NET.
XAdES, PAdES, CAdES and ASiC for documents, Authenticode, ClickOnce, NuGet and VSIX for code.
Packs, add-ons and more