clone localMedia in Member when connection, like we do for setMedia

This commit is contained in:
Bruno Windels 2022-07-07 15:36:49 +02:00
parent f187a51c97
commit 2f08cd8984
2 changed files with 3 additions and 4 deletions

View file

@ -510,8 +510,7 @@ export class GroupCall extends EventEmitter<{change: never}> {
const logItem = joinedData.membersLogItem.child({l: "member", id: memberKey});
logItem.set("sessionId", member.sessionId);
log.wrap({l: "connect", id: memberKey}, log => {
// Safari can't send a MediaStream to multiple sources, so clone it
const connectItem = member.connect(joinedData.localMedia.clone(), joinedData.localMuteSettings, logItem);
const connectItem = member.connect(joinedData.localMedia, joinedData.localMuteSettings, logItem);
if (connectItem) {
log.refDetached(connectItem);
}

View file

@ -116,7 +116,8 @@ export class Member {
if (this.connection) {
return;
}
const connection = new MemberConnection(localMedia, localMuteSettings, memberLogItem);
// Safari can't send a MediaStream to multiple sources, so clone it
const connection = new MemberConnection(localMedia.clone(), localMuteSettings, memberLogItem);
this.connection = connection;
let connectLogItem;
connection.logItem.wrap("connect", async log => {
@ -293,7 +294,6 @@ export class Member {
async setMedia(localMedia: LocalMedia, previousMedia: LocalMedia): Promise<void> {
const {connection} = this;
if (connection) {
// TODO: see if we can simplify this
connection.localMedia = localMedia.replaceClone(connection.localMedia, previousMedia);
await connection.peerCall?.setMedia(connection.localMedia, connection.logItem);
}