Native video Increment 2a: publish local camera + self-view

Wire the camera button on native calls to the plugin instead of a
"not available" toast. New NativeCall.setCamera({on}) calls LiveKit
localParticipant.setCamera(enabled:) so the iOS user's camera is
published to the room — every web/desktop peer renders it via their
existing SFU subscription. Locally the plugin shows a small rounded
self-view (VideoView) pinned top-right over the WebView.

APIs verified against client-sdk-swift 2.15.3 source: setCamera ->
LocalTrackPublication?, TrackPublication.track, VideoView(.track/.layoutMode),
CameraCaptureOptions(position:.front). Front camera only for now.

Rendering the OTHER participants as native tiles synced to the web
meeting grid is Increment 2b (the fragile part) — next build. Until the
new IPA ships, the web branch falls back to an "update the app" toast.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-08-05 23:10:19 +05:30
parent f27b7af9e4
commit 149e32b8d8
2 changed files with 71 additions and 1 deletions
+10 -1
View File
@@ -5469,7 +5469,16 @@ async function toggleMic(){
// renegotiates with every peer, so you can always turn video on once a meeting has started.
async function toggleCam(){
if(!meetLocalStream) return;
if(meetNative){ toast('Video isnt available on native calls yet'); return; } // native path is audio-only for now (video rendering is the next phase)
if(meetNative){ // native call: the plugin owns the LiveKit media, so the camera is published natively.
const next=!meetCam; const NC=nativeCallPlugin();
if(!NC||!NC.setCamera){ toast('Update the app to use video on calls'); return; }
try{ await NC.setCamera({ on:next }); }catch(e){ toast('Could not turn the camera '+(next?'on':'off')); return; }
meetCam=next; meetAudioOnly=false; updateCamBtn();
// The web __local tile stays an avatar — the WebView has no camera stream in a native call (the plugin
// owns media and draws its own self-view). Tell peers our camera state so their SFU tile shows the video.
meetSend({type:'meeting-state', muted:!meetMic, camOff:!meetCam});
return;
}
if(SFU.on){ const next=!meetCam; try{ await sfuSetCam(next); meetCam=next; meetAudioOnly=false; }catch(e){ toast(mediaErrMsg(e,'camera')); return; } updateCamBtn(); addTile('__local', meetLocalStream, (ME&&ME.name)?ME.name:'You', true); setTileMute('__local', !meetMic); meetSend({type:'meeting-state', muted:!meetMic, camOff:!meetCam}); return; }
const hasTrack=meetLocalStream.getVideoTracks().length>0;
if(!hasTrack){