TsgcICEClientEvents › OnICECandidate

OnICECandidate Event

Fires once per local candidate discovered during gathering; forward the candidate to the remote peer via signalling.

Syntax

property OnICECandidate: TsgcICECandidateEvent;
// TsgcICECandidateEvent = procedure(Sender: TObject; const aCandidate: TsgcICE_Candidate) of object

Default Value

Remarks

Fires for every candidate produced by GatherCandidates — a local host interface, a server-reflexive address obtained via STUN, or a relayed address from the TURN allocation. Read aCandidate.CandidateType, aCandidate.IP, aCandidate.Port, aCandidate.Foundation and aCandidate.Priority, or use the pre-formatted aCandidate.Candidate SDP attribute to send the candidate to the peer through your signalling channel (WebSocket, HTTP, SSE, ...). The remote side will hand your string to its own addIceCandidate / AddRTCIceCandidate.

Example

procedure TForm1.oICEICECandidate(Sender: TObject;
  const aCandidate: TsgcICE_Candidate);
begin
  DoLog('Candidate: ' + aCandidate.Candidate);
  // send the candidate to the remote peer via signalling
  oSignalling.WriteData(aCandidate.Candidate);
end;

Back to Events