feat(call): Details card for the call-ended toast (#253)
The call-ended toast gets a Details button (and stays 10 s) that opens a card with who was in the call and the peak, connection verdict and reconnects, how long your / each person's / everyone's connection was poor (likely the server when everyone), RTT, packet loss and jitter, and your talk, mute, deafen and screenshare time, in technical wording. Deafened time is tracked by CallEmbed; the rest comes from the fork's new io.lotus.call_summary `details` (lotus.29). Settings → Calls gets "Summary After Calls" (on by default). Fixes #253 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
8784a8158c
commit
8645a55769
@@ -26,13 +26,14 @@ import {
|
||||
ElementMediaStateDetail,
|
||||
ElementWidgetActions,
|
||||
} from './types';
|
||||
import { CallControl } from './CallControl';
|
||||
import { CallControl, CallControlEvent } from './CallControl';
|
||||
import { CallControlState } from './CallControlState';
|
||||
import { verifyDenoiseAssets } from './denoiseSmokeCheck';
|
||||
import { canDelegateCapability } from './utils';
|
||||
import { getCallPageUrl } from './callPageUrl';
|
||||
import { restrictWidgetMessages } from '../widgetTransport';
|
||||
import { isRingableRoom } from '../../utils/callRing';
|
||||
import { parseCallSummaryDetails, type LotusCallSummaryDetails } from '../../utils/callSummary';
|
||||
|
||||
// Maximum time to wait for the embedded Element Call iframe to progress from
|
||||
// initial load to a ready/joined state. If it hasn't by then, we assume the
|
||||
@@ -59,6 +60,8 @@ export interface LotusCallSummary {
|
||||
reconnects: number;
|
||||
poorMs: number;
|
||||
verdict: 'good' | 'fair' | 'poor' | 'unknown';
|
||||
/** [Gitea #253] Breakdown for the Details card (fork lotus.29+). */
|
||||
details?: LotusCallSummaryDetails;
|
||||
}
|
||||
|
||||
export class CallEmbed {
|
||||
@@ -78,6 +81,25 @@ export class CallEmbed {
|
||||
/** [Gitea #143] The fork's end-of-call summary, once it arrives. */
|
||||
public lastSummary: LotusCallSummary | undefined;
|
||||
|
||||
// [Gitea #253] Time spent deafened (sound off), for the post-call Details.
|
||||
private deafenedSince: number | undefined;
|
||||
|
||||
private deafenedTotal = 0;
|
||||
|
||||
public deafenedMs(now = Date.now()): number {
|
||||
return this.deafenedTotal + (this.deafenedSince === undefined ? 0 : now - this.deafenedSince);
|
||||
}
|
||||
|
||||
private trackDeafened = (): void => {
|
||||
if (!this.joined) return;
|
||||
const deaf = !this.control.sound;
|
||||
if (deaf && this.deafenedSince === undefined) this.deafenedSince = Date.now();
|
||||
if (!deaf && this.deafenedSince !== undefined) {
|
||||
this.deafenedTotal += Date.now() - this.deafenedSince;
|
||||
this.deafenedSince = undefined;
|
||||
}
|
||||
};
|
||||
|
||||
// C-M4: set once dispose() has run so the hangup fallback timer can tell
|
||||
// whether the embed was already torn down by the normal Close/Hangup echo.
|
||||
public disposed = false;
|
||||
@@ -339,6 +361,8 @@ export class CallEmbed {
|
||||
const controlState = initialControlState ?? new CallControlState(true, false, true);
|
||||
this.control = new CallControl(controlState, call, iframe);
|
||||
this.initialState = controlState;
|
||||
this.control.on(CallControlEvent.StateUpdate, this.trackDeafened);
|
||||
this.disposables.push(() => this.control.off(CallControlEvent.StateUpdate, this.trackDeafened));
|
||||
// If the iframe document itself fails to load, fail fast.
|
||||
iframe.onerror = () => {
|
||||
this.settleLoad('iframe');
|
||||
@@ -434,6 +458,7 @@ export class CallEmbed {
|
||||
reconnects: data.reconnects ?? 0,
|
||||
poorMs: data.poorMs ?? 0,
|
||||
verdict: data.verdict ?? 'unknown',
|
||||
details: parseCallSummaryDetails((data as { details?: unknown }).details),
|
||||
};
|
||||
}
|
||||
}),
|
||||
@@ -623,6 +648,7 @@ export class CallEmbed {
|
||||
}
|
||||
this.joined = true;
|
||||
this.joinedAt = Date.now();
|
||||
this.trackDeafened();
|
||||
// EC ignores io.element.device_mute before join; re-apply desired state now that EC is live
|
||||
this.control.forceState(this.initialState);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user