fix(calls): resolve EC mute hang, robust camera focus, PiP NaN guard (N122/N123/N126)

- N122: setMediaState resolves on EC's transport ACK instead of waiting for a
  DeviceMute state-echo that EC may elide or skip during teardown — which
  previously stranded the promise forever and silently skipped the initial
  deafen state + first StateUpdate on join. Dropped the single-slot
  mediaStatePromiseResolver; onMediaState remains the authoritative sync path.
- N123: focusCameraParticipant now waits for a spotlight videoTile to mount via
  a MutationObserver (with a 600ms hard-timeout fallback) instead of a fixed
  2-frame delay that EC's React commit can exceed on slower devices.
- N126: PiP position restored from localStorage is shape+finiteness validated,
  so corrupt data can't feed NaN into the position math (invalid 'NaNpx' CSS).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-28 09:17:19 -04:00
parent 84a2e7a93e
commit 49d9410e3a
2 changed files with 49 additions and 18 deletions
+19 -1
View File
@@ -720,7 +720,25 @@ export function CallEmbedProvider({ children }: CallEmbedProviderProps) {
if (pipMode) {
if (!wasInPip) {
const saved = localStorage.getItem('pip-position');
const savedPos = saved ? (JSON.parse(saved) as { left: number; top: number }) : null;
let savedPos: { left: number; top: number } | null = null;
if (saved) {
try {
const raw = JSON.parse(saved) as { left?: unknown; top?: unknown };
// Validate shape + finiteness: a corrupt value would otherwise feed
// NaN into Math.min and produce an invalid `NaNpx` CSS value.
if (
raw &&
typeof raw.left === 'number' &&
Number.isFinite(raw.left) &&
typeof raw.top === 'number' &&
Number.isFinite(raw.top)
) {
savedPos = { left: raw.left, top: raw.top };
}
} catch {
savedPos = null;
}
}
el.style.right = 'auto';
el.style.bottom = 'auto';
if (savedPos) {