Add callType to createCall function parameters

This commit is contained in:
Robert Long 2022-04-18 21:58:49 -07:00
parent 85b77e277f
commit 0f340282e7
2 changed files with 4 additions and 4 deletions

View File

@ -107,7 +107,7 @@ export class CallHandler {
});
}
async createCall(roomId: string, localMedia: LocalMedia, name: string, intent: CallIntent = CallIntent.Ring): Promise<GroupCall> {
async createCall(roomId: string, callType: "m.video" | "m.voice", name: string, intent: CallIntent = CallIntent.Ring): Promise<GroupCall> {
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({

View File

@ -157,7 +157,7 @@ export class GroupCall extends EventEmitter<{change: never}> {
}
/** @internal */
create(localMedia: LocalMedia): Promise<void> {
create(callType: "m.video" | "m.voice"): Promise<void> {
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();