detect calls using a foci

This commit is contained in:
Bruno Windels 2023-01-27 10:01:53 +01:00
parent 90ba35da7a
commit 43dea3bfdc
3 changed files with 20 additions and 0 deletions

View File

@ -22,11 +22,17 @@ export enum EventType {
// TODO: Change to "sdp_stream_metadata" when MSC3077 is merged // TODO: Change to "sdp_stream_metadata" when MSC3077 is merged
export const SDPStreamMetadataKey = "org.matrix.msc3077.sdp_stream_metadata"; export const SDPStreamMetadataKey = "org.matrix.msc3077.sdp_stream_metadata";
export interface FocusConfig {
user_id: string,
device_id: string
}
export interface CallDeviceMembership { export interface CallDeviceMembership {
device_id: string, device_id: string,
session_id: string, session_id: string,
["expires_ts"]?: number, ["expires_ts"]?: number,
feeds?: Array<{purpose: string}> feeds?: Array<{purpose: string}>
["m.foci.active"]?: Array<FocusConfig>
} }
export interface CallMembership { export interface CallMembership {

View File

@ -145,6 +145,15 @@ export class GroupCall extends EventEmitter<{change: never}> {
return !!this.callContent?.["m.terminated"]; 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 { get duration(): number | undefined {
if (typeof this.startTime === "number") { if (typeof this.startTime === "number") {
return (this.options.clock.now() - this.startTime); return (this.options.clock.now() - this.startTime);

View File

@ -117,6 +117,11 @@ export class Member {
return this.errorBoundary.error; 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) { private _renewExpireTimeout(log: ILogItem) {
this.expireTimeout?.dispose(); this.expireTimeout?.dispose();
this.expireTimeout = undefined; this.expireTimeout = undefined;