TsgcRTCPeerConnectionEvents › OnRTCLocalCandidate

OnRTCLocalCandidate Event

Fired when a local ICE candidate has been gathered; set Accept to False to drop it.

Syntax

property OnRTCLocalCandidate: TsgcRTCLocalCandidateEvent;
// TsgcRTCLocalCandidateEvent = procedure(Sender: TObject; const aCandidate: string; var Accept: Boolean) of object

Default Value

Remarks

Raised every time the ICE agent produces a new local candidate — host (local network addresses), server-reflexive (obtained via STUN) or relay (allocated on the TURN server). aCandidate contains the SDP candidate line ("candidate:..."). When Accept is True the candidate is forwarded to the remote peer through the signalling WebSocket; set Accept to False to filter it out (for example to drop host candidates on specific interfaces or to hide private addresses).

Example

procedure TForm1.oRTCLocalCandidate(Sender: TObject;
  const aCandidate: string; var Accept: Boolean);
begin
  // ... filter out IPv6 candidates
  Accept := Pos(' 192.168.', aCandidate) = 0;
end;

Back to Events