Improving the video transform feedback when we are connecting, and cleaning the pc_id when disconnected.

This commit is contained in:
Filipi Fuchter
2025-03-12 11:49:33 -03:00
parent f24c5b0aa7
commit f8e33d8b7b
2 changed files with 10 additions and 2 deletions

View File

@@ -129,6 +129,9 @@ class WebRTCApp {
private async start(): Promise<void> {
this.clearAllLogs()
this.connectBtn.disabled = true;
this.updateStatus("Connecting")
const audioDevice = this.audioInput.value;
const audioCodec = this.audioCodec.value;
const videoDevice = this.videoInput.value;

View File

@@ -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<void> {
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() {