feat(call): host half of the 0.25.0-lotus.2 fork changes
- io.lotus.request_state: when the fork's lotus handlers (re)register (an EC-side remount that doesn't unmount us) we re-send deafen, quality and the focus pin, and the decoration pusher re-pushes its roster — decorations and the pin no longer vanish for the rest of the call (element-call#17). - focus_participant carries the per-device media id from call_state (speaking device preferred) so a multi-device user pins the right device (element-call#30). - injectAudio returns the fork's reply; when it refuses with reason:"muted" the soundboard shows "Unmute your microphone…" instead of playing the clip locally as if it went out (element-call#13). All backwards compatible with the 0.25.0-lotus.1 bundle (unknown action is acked; missing reply fields default to "played"). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PPmy3tPq869XDW4njjVaKA
This commit is contained in:
@@ -68,6 +68,9 @@ export class CallEmbed {
|
||||
|
||||
private lotusCallStateListeners = new Set<() => void>();
|
||||
|
||||
// [Gitea #17] Listeners notified when the fork sends io.lotus.request_state.
|
||||
private forkStateRequestListeners = new Set<() => void>();
|
||||
|
||||
public readonly control: CallControl;
|
||||
|
||||
private readonly container: HTMLElement;
|
||||
@@ -373,6 +376,17 @@ export class CallEmbed {
|
||||
// [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).
|
||||
// [Gitea #17 / EC#17] The fork asks for a full state re-push whenever its
|
||||
// lotus handlers (re)register — e.g. an EC-side InCallView remount that
|
||||
// does not unmount us. Re-send the sticky fork state (deafen/quality/focus)
|
||||
// and let the decoration pusher re-send its roster.
|
||||
this.disposables.push(
|
||||
this.listenAction('io.lotus.request_state', () => {
|
||||
if (!this.joined) return;
|
||||
this.control.resendForkState();
|
||||
this.forkStateRequestListeners.forEach((l) => l());
|
||||
}),
|
||||
);
|
||||
this.disposables.push(
|
||||
this.listenAction('io.lotus.call_state', (evt) => {
|
||||
const data = (evt.detail as { data?: { participants?: unknown } } | undefined)?.data;
|
||||
@@ -706,6 +720,14 @@ export class CallEmbed {
|
||||
}
|
||||
|
||||
/** [lotus #2] Subscribe to io.lotus.call_state updates. Returns an unsubscribe. */
|
||||
/** [Gitea #17] Subscribe to the fork's io.lotus.request_state. Returns an unsubscribe. */
|
||||
public onForkStateRequest(cb: () => void): () => void {
|
||||
this.forkStateRequestListeners.add(cb);
|
||||
return () => {
|
||||
this.forkStateRequestListeners.delete(cb);
|
||||
};
|
||||
}
|
||||
|
||||
public onLotusCallState(cb: () => void): () => void {
|
||||
this.lotusCallStateListeners.add(cb);
|
||||
return () => {
|
||||
|
||||
Reference in New Issue
Block a user