fix(calls): play native LiveKit participants in the WebView meeting (inc 1 interop)
Native (CallKit+LiveKit) participants join the LiveKit room but not our WS mesh, so
peerIdForUid() had no mapping and sfuAttach dropped their track — the web caller stayed
on 'waiting' and never heard the native callee. Now sfuAttach/sfuDetach fall back to
keying the tile+audio by the LiveKit identity ('lk:'+id) when there's no mesh peer, and
stop the ringback. So a native<->web call crosses audio. Served — no rebuild.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -4407,10 +4407,14 @@ function sfuRebuild(pid){
|
||||
addTile(pid, st, meetNames.get(pid)||'Guest', false); setTileScreen(pid, !!p.screen); meetWatchStream(pid, st);
|
||||
}
|
||||
function sfuAttach(pub, track, participant, _try){
|
||||
const pid=peerIdForUid(participant.identity);
|
||||
if(!pid){ // #9: uid→peerId map (from the mesh join) may lag the LiveKit track — retry a few times
|
||||
if((_try||0)<10){ setTimeout(()=>sfuAttach(pub,track,participant,(_try||0)+1), 400); }
|
||||
return;
|
||||
let pid=peerIdForUid(participant.identity);
|
||||
if(!pid){ // uid→peerId map (from the mesh join) may lag the LiveKit track — retry a few times…
|
||||
if((_try||0)<6){ setTimeout(()=>sfuAttach(pub,track,participant,(_try||0)+1), 400); return; }
|
||||
// …then fall back: a NATIVE (CallKit + LiveKit) participant joins LiveKit but NOT our WS mesh, so it has
|
||||
// no mesh peer id. Key its tile + audio by the LiveKit identity so it still shows and is heard.
|
||||
pid='lk:'+participant.identity;
|
||||
if(!meetNames.get(pid)) meetNames.set(pid, participant.name||'Caller');
|
||||
stopRingback();
|
||||
}
|
||||
const p=SFU.peers.get(pid)||{}; SFU.peers.set(pid,p); const mt=track.mediaStreamTrack;
|
||||
if(track.kind==='audio') p.audio=mt;
|
||||
@@ -4419,7 +4423,7 @@ function sfuAttach(pub, track, participant, _try){
|
||||
sfuRebuild(pid); updateShareMode();
|
||||
}
|
||||
function sfuDetach(pub, track, participant){
|
||||
const pid=peerIdForUid(participant.identity); if(!pid) return; const p=SFU.peers.get(pid); if(!p) return; const mt=track.mediaStreamTrack;
|
||||
let pid=peerIdForUid(participant.identity); if(!pid) pid='lk:'+participant.identity; const p=SFU.peers.get(pid); if(!p) return; const mt=track.mediaStreamTrack;
|
||||
if(p.audio===mt) p.audio=null; else if(p.screen===mt){ p.screen=null; meetSharers.delete(pid); setTileScreen(pid,false); } else if(p.cam===mt) p.cam=null;
|
||||
sfuRebuild(pid); updateShareMode();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user