iOS "Share Screen": route to a screen-share meeting (remote-support on iPhone)
The remote-support Share/Connect tabs use P2P WebRTC (screen + voice + chat) that WKWebView can't capture, so "Share Screen" never worked on iPhone. Rather than rebuild the whole P2P session on LiveKit, route iOS "Share Screen" to a screen-share MEETING (chosen with the user): tapping Share Screen on iOS starts an instant meeting, auto-starts the native ReplayKit screen share (the path just verified on device), and toasts the join code. A helper joins by code (Meeting) to watch — and gets voice + chat for free. Viewing already works in the webview, so only the SHARE side is rerouted; desktop keeps the full P2P remote-support flow, and iOS Safari (no app) is unchanged. Web-only, no new build (reuses the shipped startMeetingScreenShare native method). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -6153,6 +6153,9 @@ async function onMeetMsg(e){
|
|||||||
if(_pendingJoinMic){ _pendingJoinMic=false; if(!meetMic){ try{ await toggleMic(); }catch(_){} } }
|
if(_pendingJoinMic){ _pendingJoinMic=false; if(!meetMic){ try{ await toggleMic(); }catch(_){} } }
|
||||||
if(_pendingJoinCam){ _pendingJoinCam=false; if(!meetCam){ try{ await toggleCam(); }catch(_){} } }
|
if(_pendingJoinCam){ _pendingJoinCam=false; if(!meetCam){ try{ await toggleCam(); }catch(_){} } }
|
||||||
refreshMeetPanel(); updateHostControls();
|
refreshMeetPanel(); updateHostControls();
|
||||||
|
// 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;
|
return;
|
||||||
}
|
}
|
||||||
// The room is gone (host ended it / code expired). Say so plainly instead of hanging on "Connecting…"
|
// The room is gone (host ended it / code expired). Say so plainly instead of hanging on "Connecting…"
|
||||||
@@ -6311,7 +6314,20 @@ const panels=document.querySelectorAll('.panel');
|
|||||||
const chatcol=document.getElementById('chatcol');
|
const chatcol=document.getElementById('chatcol');
|
||||||
let loaded={share:false,connect:false};
|
let loaded={share:false,connect:false};
|
||||||
function currentTab(){ const b=document.querySelector('.railbtn.active'); return b?b.dataset.tab:'chat'; }
|
function currentTab(){ const b=document.querySelector('.railbtn.active'); return b?b.dataset.tab:'chat'; }
|
||||||
|
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.)
|
||||||
|
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; }
|
||||||
|
_autoShareOnJoin=true;
|
||||||
|
switchTab('meeting');
|
||||||
|
enterMeeting(null); // start an instant meeting; the auto-share fires once meeting-joined gives us a peerId
|
||||||
|
}
|
||||||
function switchTab(tab){
|
function switchTab(tab){
|
||||||
|
if(tab==='share' && SFU.on && bzIsIOS()){ startIosScreenShareMeeting(); return; } // iOS: screen-share via a meeting, not the P2P iframe
|
||||||
railBtns.forEach(b=>b.classList.toggle('active',b.dataset.tab===tab));
|
railBtns.forEach(b=>b.classList.toggle('active',b.dataset.tab===tab));
|
||||||
panels.forEach(p=>p.classList.toggle('active',p.dataset.panel===tab));
|
panels.forEach(p=>p.classList.toggle('active',p.dataset.panel===tab));
|
||||||
chatcol.classList.toggle('hidden', tab!=='chat');
|
chatcol.classList.toggle('hidden', tab!=='chat');
|
||||||
|
|||||||
Reference in New Issue
Block a user