diff --git a/server/public/home.html b/server/public/home.html index a9c1942..3930d39 100644 --- a/server/public/home.html +++ b/server/public/home.html @@ -6153,9 +6153,9 @@ async function onMeetMsg(e){ if(_pendingJoinMic){ _pendingJoinMic=false; if(!meetMic){ try{ await toggleMic(); }catch(_){} } } if(_pendingJoinCam){ _pendingJoinCam=false; if(!meetCam){ try{ await toggleCam(); }catch(_){} } } refreshMeetPanel(); updateHostControls(); - // iOS "Share Screen" entry: show the code + a "waiting for them to join" screen. The screen broadcast - // only STARTS once the helper joins (see meeting-peer-joined) — matching the remote-support mental model. - if(_shareWaitMode){ showShareWaitOverlay(meetRoom); } + // iOS "Share Screen" entry: auto-start the native screen broadcast now that we have a peerId + room, and + // surface the code so the user can hand it to whoever should watch. + if(_autoShareOnJoin){ _autoShareOnJoin=false; setTimeout(()=>{ try{ toggleScreen(); }catch(_){} if(meetRoom) toast('Share code '+meetRoom+' so others can watch your screen.'); }, 800); } return; } // The room is gone (host ended it / code expired). Say so plainly instead of hanging on "Connecting…" @@ -6176,8 +6176,6 @@ async function onMeetMsg(e){ meetSend({type:'meeting-state', muted:!meetMic, camOff:!meetCam}); if(meetIsHost){ meetSend({type:'meeting-host', to:meetHostId}); meetSend({type:'meeting-sharemode', multi:meetMultiShare}); if(meetRec) meetSend({type:'meeting-recording', on:true}); } if(meetScreen) meetSend({type:'meeting-screen', on:true}); - // iOS "Share Screen": the helper just joined → dismiss the waiting screen and start the screen broadcast now. - if(_shareWaitMode){ _shareWaitMode=false; hideShareWaitOverlay(); setTimeout(()=>{ try{ toggleScreen(); }catch(_){} }, 300); } refreshMeetPanel(); return; } if(m.type==='meeting-peer-state'){ setTileMute(m.peerId, !!m.muted); meetCamOff.set(m.peerId, !!m.camOff); const _t=document.getElementById('meet-tile-'+m.peerId); if(_t){ const v=_t.querySelector('video'), s=v&&v.srcObject; const hv=!!(s&&s.getVideoTracks&&s.getVideoTracks().some(tr=>tr.enabled&&tr.readyState!=='ended')); _t.classList.toggle('novid', !hv || (!!m.camOff && !meetSharers.has(m.peerId))); } refreshMeetPanel(); return; } // camOff -> avatar, unless sharing a screen (#9) @@ -6316,40 +6314,18 @@ const panels=document.querySelectorAll('.panel'); const chatcol=document.getElementById('chatcol'); let loaded={share:false,connect:false}; function currentTab(){ const b=document.querySelector('.railbtn.active'); return b?b.dataset.tab:'chat'; } -let _shareWaitMode=false; +let _autoShareOnJoin=false; // iOS "Share Screen": WKWebView can't capture the P2P remote-support flow, so route it to a screen-share // MEETING — the native ReplayKit path publishes into LiveKit, and a helper joins by code to watch (+ talk/chat). // (Viewing a shared screen already works in the webview; only capture is blocked, so only the SHARE side moves.) -// UX: show the code + "waiting" first; screen sharing only STARTS once the helper joins (like remote support). function startIosScreenShareMeeting(){ const NC=nativeCallPlugin(); if(!NC || typeof NC.startMeetingScreenShare!=='function'){ switchTab('meeting'); toast('Update the app to share your screen'); return; } if(meetState==='call'){ switchTab('meeting'); toast('You’re already in a meeting — tap Share screen there.'); return; } - _shareWaitMode=true; + _autoShareOnJoin=true; switchTab('meeting'); - enterMeeting(null); // instant meeting; on join we show the code + wait, then auto-share when the helper joins + enterMeeting(null); // start an instant meeting; the auto-share fires once meeting-joined gives us a peerId } -// Full-screen "give this code, waiting to join" screen shown to the iOS sharer before anyone connects. -function showShareWaitOverlay(code){ - hideShareWaitOverlay(); - const ov=document.createElement('div'); ov.id='shareWaitOv'; - ov.style.cssText='position:fixed;inset:0;z-index:9200;background:linear-gradient(180deg,#20396f,#16294f);color:#fff;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:24px;text-align:center'; - ov.innerHTML='