diff --git a/examples/aiortc/video-transform/client/typescript/src/app.ts b/examples/aiortc/video-transform/client/typescript/src/app.ts index 0c86a5c85..e2fabc1eb 100644 --- a/examples/aiortc/video-transform/client/typescript/src/app.ts +++ b/examples/aiortc/video-transform/client/typescript/src/app.ts @@ -129,6 +129,9 @@ class WebRTCApp { private async start(): Promise { this.clearAllLogs() + this.connectBtn.disabled = true; + this.updateStatus("Connecting") + const audioDevice = this.audioInput.value; const audioCodec = this.audioCodec.value; const videoDevice = this.videoInput.value; diff --git a/examples/aiortc/video-transform/client/typescript/src/smallWebRTCTransport.ts b/examples/aiortc/video-transform/client/typescript/src/smallWebRTCTransport.ts index 5f53f058f..5a988ad56 100644 --- a/examples/aiortc/video-transform/client/typescript/src/smallWebRTCTransport.ts +++ b/examples/aiortc/video-transform/client/typescript/src/smallWebRTCTransport.ts @@ -74,7 +74,7 @@ export class SmallWebRTCTransport { if (connectionState == 'connected') { this._callbacks.onConnected() } else if (connectionState == 'disconnected') { - this._callbacks.onDisconnected() + this.handleDisconnected() } } @@ -167,6 +167,11 @@ export class SmallWebRTCTransport { return this.pc!.getTransceivers()[1]; } + private handleDisconnected() { + this.pc_id = null + this._callbacks.onDisconnected() + } + async start(audioDevice: string | undefined, audioCodec: string, videoCodec: string, videoDevice: string | undefined): Promise { this.pc = this.createPeerConnection(); this.addInitialTransceivers(); @@ -299,7 +304,7 @@ export class SmallWebRTCTransport { this.pc.close(); // For some reason after we close the peer connection, it is not triggering the listeners - this._callbacks.onDisconnected() + this.handleDisconnected() } private async getAllDevices() {