diff --git a/src/matrix/calls/callEventTypes.ts b/src/matrix/calls/callEventTypes.ts index a0eb986c..879d0c11 100644 --- a/src/matrix/calls/callEventTypes.ts +++ b/src/matrix/calls/callEventTypes.ts @@ -22,11 +22,17 @@ export enum EventType { // TODO: Change to "sdp_stream_metadata" when MSC3077 is merged export const SDPStreamMetadataKey = "org.matrix.msc3077.sdp_stream_metadata"; +export interface FocusConfig { + user_id: string, + device_id: string +} + export interface CallDeviceMembership { device_id: string, session_id: string, ["expires_ts"]?: number, feeds?: Array<{purpose: string}> + ["m.foci.active"]?: Array } export interface CallMembership { diff --git a/src/matrix/calls/group/GroupCall.ts b/src/matrix/calls/group/GroupCall.ts index e0099f4e..16f09dd2 100644 --- a/src/matrix/calls/group/GroupCall.ts +++ b/src/matrix/calls/group/GroupCall.ts @@ -145,6 +145,15 @@ export class GroupCall extends EventEmitter<{change: never}> { return !!this.callContent?.["m.terminated"]; } + get usesFoci(): boolean { + for (const member of this._members.values()) { + if (member.usesFoci) { + return true; + } + } + return false; + } + get duration(): number | undefined { if (typeof this.startTime === "number") { return (this.options.clock.now() - this.startTime); diff --git a/src/matrix/calls/group/Member.ts b/src/matrix/calls/group/Member.ts index e097804c..ab99c6b8 100644 --- a/src/matrix/calls/group/Member.ts +++ b/src/matrix/calls/group/Member.ts @@ -117,6 +117,11 @@ export class Member { return this.errorBoundary.error; } + get usesFoci(): boolean { + const activeFoci = this.callDeviceMembership["m.foci.active"]; + return Array.isArray(activeFoci) && activeFoci.length > 0; + } + private _renewExpireTimeout(log: ILogItem) { this.expireTimeout?.dispose(); this.expireTimeout = undefined;