prevent localMedia being disposed when disconnecting on session change

this would cause us to not send any media anymore and a black screen
on the other side that just refreshed
This commit is contained in:
Bruno Windels 2022-04-27 11:34:01 +01:00
parent beeb191588
commit 6b22078140

View file

@ -112,8 +112,8 @@ export class Member {
} }
/** @internal */ /** @internal */
disconnect(hangup: boolean, log?: ILogItem) { disconnect(hangup: boolean) {
(log ?? this.logItem).wrap("disconnect", log => { this.logItem.wrap("disconnect", log => {
if (hangup) { if (hangup) {
this.peerCall?.hangup(CallErrorCode.UserHangup); this.peerCall?.hangup(CallErrorCode.UserHangup);
} else { } else {
@ -136,7 +136,13 @@ export class Member {
oldSessionId: this.sessionId, oldSessionId: this.sessionId,
newSessionId: callDeviceMembership.session_id newSessionId: callDeviceMembership.session_id
}, log => { }, log => {
this.disconnect(false, log); // prevent localMedia from being stopped
// as connect won't be called again when reconnecting
// to the new session
const localMedia = this.localMedia;
this.localMedia = undefined;
this.disconnect(false);
this.localMedia = localMedia;
}); });
} }
this.callDeviceMembership = callDeviceMembership; this.callDeviceMembership = callDeviceMembership;