export interface MediaConnectionAwaiterProps { webrtcMediaConnection: any; correlationId: string; } /** * @class MediaConnectionAwaiter */ export default class MediaConnectionAwaiter { private webrtcMediaConnection; private timer; private defer; private retried; private iceConnected; private correlationId; private onTimeoutCallback; private peerConnectionStateCallback; private iceConnectionStateCallback; private iceGatheringStateCallback; /** * @param {MediaConnectionAwaiterProps} mediaConnectionAwaiterProps */ constructor({ webrtcMediaConnection, correlationId }: MediaConnectionAwaiterProps); /** * Returns true if the connection is connected, false otherwise. * * @returns {boolean} */ private isConnected; /** * Returns true if the connection is in an unrecoverable "failed" state * * @returns {boolean} */ private isFailed; /** * Returns true if the ICE Gathering is completed, false otherwise. * * @returns {boolean} */ private isIceGatheringCompleted; /** * Clears the callbacks. * * @returns {void} */ private clearCallbacks; /** * On connection state change. * * @returns {void} */ connectionStateChange(): void; /** * Listener for peer connection state change. * * @returns {void} */ peerConnectionStateHandler(): void; /** * Listener for ICE connection state change. * * @returns {void} */ iceConnectionStateHandler(): void; /** * Listener for ICE gathering state change. * * @returns {void} */ iceGatheringStateHandler(): void; /** * sends a metric with some additional info that might help debugging * issues where browser doesn't update the RTCPeerConnection's iceConnectionState or connectionState * * @returns {void} */ sendMetric(): Promise; /** * Function called when the timeout is reached. * * @returns {void} */ onTimeout(): void; /** * Waits for the webrtc media connection to be connected. * * @returns {Promise} */ waitForMediaConnectionConnected(): Promise; }