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:
@@ -71,7 +71,12 @@ function ParticipantMenu({
|
||||
if (isFocused) {
|
||||
callEmbed?.control.clearFocusParticipant();
|
||||
} else {
|
||||
callEmbed?.control.focusCameraParticipant(userId);
|
||||
// [EC#30] Pass the fork's per-device media id when we have one (from
|
||||
// io.lotus.call_state) so a multi-device user pins the active device.
|
||||
const parts = callEmbed?.getLotusParticipants() ?? [];
|
||||
const mine = parts.filter((p) => p.userId === userId);
|
||||
const pick = mine.find((p) => p.speaking) ?? mine.find((p) => p.audioEnabled) ?? mine[0];
|
||||
callEmbed?.control.focusCameraParticipant(userId, pick?.id ?? null);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -115,7 +115,18 @@ export function CallSoundboard({ callEmbed }: CallSoundboardProps) {
|
||||
try {
|
||||
const url = await resolveClipObjectUrl(mx, flat.clip.url);
|
||||
const vol = (flat.clip.volume / 100) * master;
|
||||
callEmbed.control.injectAudio(url, vol);
|
||||
const result = await callEmbed.control.injectAudio(url, vol);
|
||||
if (!result.played) {
|
||||
// [EC#13] Refused fork-side (only reason today: local mic muted) —
|
||||
// don't play it locally either, or the user would think it went out.
|
||||
setError(
|
||||
result.reason === 'muted'
|
||||
? 'Unmute your microphone to play a soundboard clip.'
|
||||
: 'Could not play that clip.',
|
||||
);
|
||||
done();
|
||||
return;
|
||||
}
|
||||
const audio = playClipLocally(url, vol);
|
||||
if (audio) {
|
||||
audio.addEventListener('ended', done, { once: true });
|
||||
|
||||
@@ -51,6 +51,11 @@ export function LotusDecorationPusher({ callEmbed }: { callEmbed: CallEmbed }):
|
||||
pushTimer.current = setTimeout(push, 300);
|
||||
}, [push]);
|
||||
|
||||
// [Gitea #17] The fork asks for a re-push when its decoration handler
|
||||
// (re)registers; our map hasn't changed, so the change-driven push above
|
||||
// would never fire on its own.
|
||||
useEffect(() => callEmbed.onForkStateRequest(schedulePush), [callEmbed, schedulePush]);
|
||||
|
||||
const onResolve = useCallback(
|
||||
(userId: string, url: string | null) => {
|
||||
const prev = map.current.get(userId);
|
||||
|
||||
Reference in New Issue
Block a user