From 0f340282e7e00947cdc402e8be8e5ce667f9c1f4 Mon Sep 17 00:00:00 2001 From: Robert Long Date: Mon, 18 Apr 2022 21:58:49 -0700 Subject: [PATCH] Add callType to createCall function parameters --- src/matrix/calls/CallHandler.ts | 4 ++-- src/matrix/calls/group/GroupCall.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/matrix/calls/CallHandler.ts b/src/matrix/calls/CallHandler.ts index b49ca3c5..2ed8bf87 100644 --- a/src/matrix/calls/CallHandler.ts +++ b/src/matrix/calls/CallHandler.ts @@ -107,7 +107,7 @@ export class CallHandler { }); } - async createCall(roomId: string, localMedia: LocalMedia, name: string, intent: CallIntent = CallIntent.Ring): Promise { + async createCall(roomId: string, callType: "m.video" | "m.voice", name: string, intent: CallIntent = CallIntent.Ring): Promise { const logItem = this.options.logger.child({l: "call", incoming: false}); const call = new GroupCall(makeId("conf-"), true, { "m.name": name, @@ -116,7 +116,7 @@ export class CallHandler { this._calls.set(call.id, call); try { - await call.create(localMedia); + await call.create(callType); // store call info so it will ring again when reopening the app const txn = await this.options.storage.readWriteTxn([this.options.storage.storeNames.calls]); txn.calls.add({ diff --git a/src/matrix/calls/group/GroupCall.ts b/src/matrix/calls/group/GroupCall.ts index 892ed67c..619c2c4f 100644 --- a/src/matrix/calls/group/GroupCall.ts +++ b/src/matrix/calls/group/GroupCall.ts @@ -157,7 +157,7 @@ export class GroupCall extends EventEmitter<{change: never}> { } /** @internal */ - create(localMedia: LocalMedia): Promise { + create(callType: "m.video" | "m.voice"): Promise { return this.logItem.wrap("create", async log => { if (this._state !== GroupCallState.Fledgling) { return; @@ -165,7 +165,7 @@ export class GroupCall extends EventEmitter<{change: never}> { this._state = GroupCallState.Creating; this.emitChange(); this.callContent = Object.assign({ - "m.type": localMedia.userMedia?.videoTrack ? "m.video" : "m.voice", + "m.type": callType, }, this.callContent); const request = this.options.hsApi.sendState(this.roomId, EventType.GroupCall, this.id, this.callContent!, {log}); await request.response();