call: consume self-built Element Call fork + activate Lotus features
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:
+12
-30
@@ -16,13 +16,15 @@ const copyFiles = {
|
||||
// widget URL (/public/element-call/index.html) resolves. v4.x of
|
||||
// vite-plugin-static-copy preserves the full source path under dest, so
|
||||
// we strip the 4 leading segments of the source base
|
||||
// (node_modules/@element-hq/element-call-embedded/dist) — mirroring the
|
||||
// (node_modules/@lotusguild/element-call-embedded/dist) — mirroring the
|
||||
// stripBase pattern used by the android/locales targets below. The old
|
||||
// `rename: 'element-call'` form silently produced
|
||||
// public/node_modules/.../dist/ under v4.x, 404ing the widget (calls
|
||||
// broke on cinny-desktop; web only worked because its deployed copy was
|
||||
// a stale artifact from before the vite-plugin-static-copy v4 bump).
|
||||
src: 'node_modules/@element-hq/element-call-embedded/dist',
|
||||
// Source is our self-built fork (LotusGuild/element-call) published to
|
||||
// the Gitea npm registry; see HANDOFF_ELEMENT_CALL_FORK.md.
|
||||
src: 'node_modules/@lotusguild/element-call-embedded/dist',
|
||||
dest: 'public/element-call',
|
||||
rename: { stripBase: 4 },
|
||||
},
|
||||
@@ -159,34 +161,14 @@ function lotusDenoise() {
|
||||
fs.copyFileSync(s, d);
|
||||
});
|
||||
|
||||
const shimSrc = path.resolve('build/lotus-denoise.js');
|
||||
if (!fs.existsSync(shimSrc)) {
|
||||
throw new Error(`[lotus-denoise] Missing shim source ${shimSrc} — build aborted.`);
|
||||
}
|
||||
fs.copyFileSync(shimSrc, path.join(ecDir, 'lotus-denoise.js'));
|
||||
|
||||
// Inject the shim <script> into Element Call's index.html so it runs
|
||||
// before EC captures the mic. Verify the injection actually landed —
|
||||
// if EC's bundle ever drops its deferred module entry the replace would
|
||||
// no-op and ML would silently never engage, so fail loudly.
|
||||
const indexPath = path.join(ecDir, 'index.html');
|
||||
if (fs.existsSync(indexPath)) {
|
||||
let html = fs.readFileSync(indexPath, 'utf8');
|
||||
if (!html.includes('lotus-denoise.js')) {
|
||||
// Classic (non-deferred) script runs before EC's deferred module entry.
|
||||
html = html.replace(
|
||||
/<script type="module"/,
|
||||
'<script src="./lotus-denoise.js"></script><script type="module"',
|
||||
);
|
||||
if (!html.includes('lotus-denoise.js')) {
|
||||
throw new Error(
|
||||
'[lotus-denoise] Failed to inject shim into Element Call index.html ' +
|
||||
'(no `<script type="module">` entry found) — build aborted.',
|
||||
);
|
||||
}
|
||||
fs.writeFileSync(indexPath, html);
|
||||
}
|
||||
}
|
||||
// [lotus] DENOISE CUTOVER: the getUserMedia shim is no longer injected.
|
||||
// Our forked Element Call now runs ML denoise in-source as a real LiveKit
|
||||
// audio TrackProcessor (activated by lotusDenoiseSource=1 in CallEmbed),
|
||||
// which survives reconnects (fixes A7). We still copy the denoise/ assets
|
||||
// above because the in-source processor loads its worklets/wasm from
|
||||
// ./denoise/ at runtime. To roll back to the shim: restore the
|
||||
// copy+inject of build/lotus-denoise.js here and swap lotusDenoiseSource
|
||||
// back to lotusDenoise=ml in CallEmbed.getWidget.
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user