/** * @file RTCIceCandidate - ICE candidate representation. * * Implements the W3C RTCIceCandidate interface * (https://www.w3.org/TR/webrtc/#rtcicecandidate-interface). * * Represents an ICE (Interactive Connectivity Establishment) candidate that * describes a potential way to establish a connection with a peer. * * @license MIT * @author nmhung1210 */ /** * Initialization dictionary for RTCIceCandidate. */ interface RTCIceCandidateInit { candidate?: string; sdpMid?: string | null; sdpMLineIndex?: number | null; usernameFragment?: string | null; } /** * Parsed attributes extracted from an ICE candidate string. */ interface ParsedCandidateAttributes { foundation: string | null; component: string | null; protocol: string | null; priority: number | null; address: string | null; port: number | null; type: string | null; tcpType: string | null; relatedAddress: string | null; relatedPort: number | null; } /** * JSON representation of an RTCIceCandidate. */ interface RTCIceCandidateJSON { candidate: string; sdpMid: string | null; sdpMLineIndex: number | null; usernameFragment?: string; } /** * RTCIceCandidate represents a potential method for establishing connectivity. * * ICE candidates are described using SDP (Session Description Protocol) syntax. * Each candidate describes a single address/port combination and transport protocol. */ declare class RTCIceCandidate { #private; /** * Creates a new RTCIceCandidate. * * @param {RTCIceCandidateInit} [candidateInit={}] - Initialization dictionary * @param {string} [candidateInit.candidate=''] - SDP candidate string * @param {string|null} [candidateInit.sdpMid] - Media stream ID * @param {number|null} [candidateInit.sdpMLineIndex] - M-line index * @param {string} [candidateInit.usernameFragment] - ICE username fragment * @throws {TypeError} If both sdpMid and sdpMLineIndex are null */ constructor(candidateInit?: RTCIceCandidateInit); /** * SDP candidate attribute containing the candidate description. * @type {string} */ get candidate(): string; /** * Media stream identification tag. * @type {string|null} */ get sdpMid(): string | null; /** * Index of the m-line in the SDP this candidate is associated with. * @type {number|null} */ get sdpMLineIndex(): number | null; /** * ICE username fragment. * @type {string|null} */ get usernameFragment(): string | null; /** * Unique identifier for this candidate. * @type {string|null} */ get foundation(): string | null; /** * Component identifier (rtp=1, rtcp=2). * @type {string|null} */ get component(): string | null; /** * Priority value for this candidate. * Higher priority candidates are preferred. * @type {number|null} */ get priority(): number | null; /** * IP address of this candidate. * @type {string|null} */ get address(): string | null; /** * Transport protocol (udp/tcp). * @type {string|null} */ get protocol(): string | null; /** * Port number. * @type {number|null} */ get port(): number | null; /** * Type of candidate (host, srflx, prflx, relay). * @type {string|null} */ get type(): string | null; /** * TCP candidate type (active, passive, so). * Only applicable for TCP candidates. * @type {string|null} */ get tcpType(): string | null; /** * Related address for reflexive/relay candidates. * @type {string|null} */ get relatedAddress(): string | null; /** * Related port for reflexive/relay candidates. * @type {number|null} */ get relatedPort(): number | null; /** * Converts candidate to JSON representation. * @returns {Object} JSON representation */ toJSON(): RTCIceCandidateJSON; /** * Creates an RTCIceCandidate from a candidate string. * * @param {string} candidateStr - ICE candidate string * @param {string|null} [sdpMid=null] - Media stream ID * @param {number|null} [sdpMLineIndex=0] - M-line index * @returns {RTCIceCandidate} */ static fromString(candidateStr: string, sdpMid?: string | null, sdpMLineIndex?: number | null): RTCIceCandidate; /** * Validates if a string is a valid candidate format. * * @param {string} candidateStr - String to validate * @returns {boolean} True if valid candidate format */ static isValid(candidateStr: string): boolean; } export default RTCIceCandidate; export { RTCIceCandidate }; export type { RTCIceCandidateInit, ParsedCandidateAttributes, RTCIceCandidateJSON };