call: consume self-built Element Call fork + activate Lotus features
CI / Build & Quality Checks (push) Successful in 11m5s
CI / Trigger Desktop Build (push) Successful in 25s

Switch to @lotusguild/element-call-embedded@0.20.1-lotus.1 (our self-built
fork) and turn on the source-level features it adds:

- #1 denoise CUTOVER: in-source ML denoise (lotusDenoiseSource=1) replaces
  the build-time getUserMedia shim — removed the shim injection from
  vite.config.js (denoise/ assets still shipped; the processor loads them).
  Survives reconnects (fixes A7).
- #2 call-state: CallEmbed consumes io.lotus.call_state; useCallSpeakers /
  useRemoteAllMuted prefer it over scraping EC's DOM (DOM fallback kept;
  empty payloads ignored).
- #4 focus: CallControl.focusCameraParticipant sends io.lotus.focus_participant
  (works during screenshare), replacing the DOM tile-click hack.
- #5 theming: lotusTransparent=1 (native transparent background).
- #6 decorations: LotusDecorationPusher sends each member's decoration URL
  via io.lotus.decorations -> rendered on in-call tiles.

#3 soundboard / #7 quality ship dormant (EC-ready; no host UI sends them yet).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-30 01:33:52 -04:00
parent 149ec8e4e4
commit 89cf171efc
11 changed files with 640 additions and 135 deletions
+58 -6
View File
@@ -36,6 +36,15 @@ const CALL_LOAD_WATCHDOG_MS = 25_000;
export type CallLoadErrorReason = 'timeout' | 'iframe';
/** Payload entry of the fork's io.lotus.call_state widget event (#2). */
export interface LotusCallParticipant {
id: string;
userId: string;
speaking: boolean;
audioEnabled: boolean;
videoEnabled: boolean;
}
export class CallEmbed {
private mx: MatrixClient;
@@ -47,6 +56,13 @@ export class CallEmbed {
public joined = false;
// [lotus #2] Latest per-participant state from io.lotus.call_state, or null
// until the fork sends the first one. When non-null, the speaker/mute hooks
// read it instead of scraping the EC iframe DOM.
private lotusParticipants: LotusCallParticipant[] | null = null;
private lotusCallStateListeners = new Set<() => void>();
public readonly control: CallControl;
private readonly container: HTMLElement;
@@ -148,20 +164,30 @@ export class CallEmbed {
perParticipantE2EE: room.hasEncryptionStateEvent().toString(),
lang: 'en-EN',
theme: themeKind,
// EC's built-in WebRTC suppressor: on only for 'browser' tier. For 'ml' we
// disable it here so EC doesn't do its own extra processing, and let the
// Lotus denoise shim (which keeps native NS on) handle the pipeline.
// EC's built-in WebRTC suppressor: on only for 'browser' tier. For 'ml'
// we disable it so EC captures a raw mic and the fork's in-source denoise
// TrackProcessor (lotusDenoiseSource) handles the pipeline.
noiseSuppression: (denoiseMode === 'browser').toString(),
audio: initialAudio.toString(),
video: initialVideo.toString(),
header: 'none',
// [lotus] Activate the self-built fork's in-source features (each is a
// no-op on the EC side unless its flag/action is present):
// - call-state stream (speaking/mute events) -> useCallSpeakers
// - transparent background so the room wallpaper shows through natively
lotusCallState: 'true',
lotusTransparent: 'true',
});
if (denoiseMode === 'ml') {
// Signal the Lotus denoise shim to route the mic through the ML processors.
params.append('lotusDenoise', 'ml');
// [lotus] In-source ML denoise: the fork runs RNNoise/Speex/DTLN/DFN as a
// real LiveKit audio TrackProcessor (survives reconnects — fixes A7),
// replacing the old build-time getUserMedia shim. The shim injection was
// removed from vite.config.js; the denoise/ assets are still shipped and
// loaded by the processor. lotusDenoiseSource (not lotusDenoise=ml) gates
// it so the two engines can never both run.
params.append('lotusDenoiseSource', 'true');
params.append('lotusModel', denoiseModel);
params.append('lotusNativeNS', denoiseNativeNS.toString());
params.append('lotusGate', denoiseGate.toString());
params.append('lotusGateThreshold', denoiseGateThreshold.toString());
}
@@ -318,6 +344,18 @@ export class CallEmbed {
this.disposables.push(
this.listenAction(WidgetApiFromWidgetAction.UpdateAlwaysOnScreen, () => {}),
);
// [lotus #2] Consume the fork's per-participant call-state stream. listenAction
// auto-replies {} so the fork's transport doesn't time out. Stored for the
// speaker/mute hooks (which prefer this over DOM scraping).
this.disposables.push(
this.listenAction('io.lotus.call_state', (evt) => {
const data = (evt.detail as { data?: { participants?: unknown } } | undefined)?.data;
this.lotusParticipants = Array.isArray(data?.participants)
? (data!.participants as LotusCallParticipant[])
: [];
this.lotusCallStateListeners.forEach((l) => l());
}),
);
// Populate the map of "read up to" events for this widget with the current event in every room.
// This is a bit inefficient, but should be okay. We do this for all rooms in case the widget
@@ -623,6 +661,20 @@ export class CallEmbed {
}
}
/** [lotus #2] Latest io.lotus.call_state participants, or null if the fork
* hasn't sent any yet (callers then fall back to DOM scraping). */
public getLotusParticipants(): LotusCallParticipant[] | null {
return this.lotusParticipants;
}
/** [lotus #2] Subscribe to io.lotus.call_state updates. Returns an unsubscribe. */
public onLotusCallState(cb: () => void): () => void {
this.lotusCallStateListeners.add(cb);
return () => {
this.lotusCallStateListeners.delete(cb);
};
}
public listenAction<T>(type: string, callback: (event: CustomEvent<T>) => void) {
const wrapped = (ev: CustomEvent<T>) => {
ev.preventDefault();