Stop connections on view model destroy
This commit is contained in:
@@ -55,6 +55,7 @@ export class Connection {
|
||||
}
|
||||
|
||||
public stop(): void {
|
||||
if (this.stopped) return;
|
||||
void this.livekitRoom.disconnect();
|
||||
this.stopped = true;
|
||||
}
|
||||
@@ -117,6 +118,8 @@ export class Connection {
|
||||
this.connectionState$ = this.scope.behavior<ConnectionState>(
|
||||
connectionStateObserver(this.livekitRoom),
|
||||
);
|
||||
|
||||
this.scope.onEnd(() => this.stop());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,11 +140,6 @@ export class PublishConnection extends Connection {
|
||||
}
|
||||
}
|
||||
|
||||
public stop(): void {
|
||||
void this.livekitRoom.disconnect();
|
||||
this.stopped = true;
|
||||
}
|
||||
|
||||
public constructor(
|
||||
focus: LivekitFocus,
|
||||
livekitAlias: string,
|
||||
@@ -220,7 +218,10 @@ export class PublishConnection extends Connection {
|
||||
}
|
||||
return this.livekitRoom.localParticipant.isCameraEnabled;
|
||||
});
|
||||
// TODO-MULTI-SFU: Unset mute state handlers on destroy
|
||||
this.scope.onEnd(() => {
|
||||
this.muteStates.audio.unsetHandler();
|
||||
this.muteStates.video.unsetHandler();
|
||||
});
|
||||
|
||||
const syncDevice = (
|
||||
kind: MediaDeviceKind,
|
||||
|
||||
Reference in New Issue
Block a user