TsgcRTCPeerConnectionEvents › OnRTCCandidatePairNominated

OnRTCCandidatePairNominated Event

Fired when ICE connectivity checks nominate a candidate pair; set Accept to False to reject.

Syntax

property OnRTCCandidatePairNominated: TsgcRTCCandidatePairNominatedEvent;
// TsgcRTCCandidatePairNominatedEvent = procedure(Sender: TObject; const aCandidatePair: TsgcICE_CandidatePair; var Accept: Boolean) of object

Default Value

Remarks

Raised when the ICE agent has completed its connectivity checks and selected a working path between the peers. aCandidatePair exposes the local and remote candidate (type, address, port, priority and control role). When Accept is True, the component continues the handshake (DTLS, data channel) using that pair; set Accept to False to discard the pair and wait for another nomination, which is useful to enforce policies such as "only accept non-relay paths".

Example

procedure TForm1.oRTCCandidatePairNominated(Sender: TObject;
  const aCandidatePair: TsgcICE_CandidatePair; var Accept: Boolean);
begin
  Log(Format('nominated %s:%d -> %s:%d',
    [aCandidatePair.Local.Address, aCandidatePair.Local.Port,
     aCandidatePair.Remote.Address, aCandidatePair.Remote.Port]));
  Accept := True;
end;

Back to Events