Outgoing iOS screen-share via ReplayKit broadcast extension

Lets a native-call user share their iPhone screen (whole device, works
backgrounded). LiveKit 2.15.3 ships the broadcast stack (BroadcastManager +
LKSampleHandler + IPC), so:

- New Broadcast Upload Extension target "BroadcastExtension"
  (com.bizgaze.connect.broadcast): SampleHandler.swift subclasses
  LKSampleHandler; injected by mobile/scripts/add-broadcast-extension.rb
  which also LINKS the LiveKit SPM product into the extension + sets the
  App Group. Sources in mobile/ios-broadcast/.
- Plugin: Room created with ScreenShareCaptureOptions(useBroadcastExtension:
  true); startScreenShare -> BroadcastManager.requestActivation() (system
  picker); stopScreenShare -> requestStop(); BroadcastManagerDelegate ->
  fires screenShareState to the web. LiveKit auto-publishes the track.
- ios-patch.sh: RTCScreenSharingExtension + RTCAppGroupIdentifier keys.
- codemagic.yaml: run the injector + sign the 3rd bundle id (.broadcast).
- home.html: toggleScreen native -> start/stop; screenShareState listener
  reflects state + broadcasts meeting-screen so peers' stage shows it.

REQUIRES a one-time manual Apple portal step: enable the App Group on the
com.bizgaze.connect.broadcast App ID (see mobile/IOS_SETUP.md) or the
archive fails code-signing. SPM-linked extension is new on our CI — expect
build iteration. Web deployed (no-ops on builds without startScreenShare).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-08-06 21:09:02 +05:30
parent aed3d22675
commit 27c582bceb
9 changed files with 259 additions and 3 deletions
+16
View File
@@ -76,6 +76,15 @@ workflows:
# generates already contains the new target.
ruby mobile/scripts/add-share-extension.rb
- name: Add the Broadcast (screen-share) Extension target
script: |
# Inject the ReplayKit broadcast upload extension (lets the user share their iPhone screen).
# It links the LiveKit Swift package (LKSampleHandler). Runs after cap sync so the SPM project
# + App.entitlements already exist. A build failure here is most likely the SPM product-link or
# the missing App Group capability on the com.bizgaze.connect.broadcast App ID (a one-time manual
# step in the Apple Developer portal — see mobile/IOS_SETUP.md).
ruby mobile/scripts/add-broadcast-extension.rb
- name: Set up code signing
script: |
# Create the distribution certificate + provisioning profile from the ASC API key and add the
@@ -103,6 +112,13 @@ workflows:
--type IOS_APP_STORE \
--certificate-key="@env:CERTIFICATE_PRIVATE_KEY" \
--create
# THIRD bundle id: the broadcast (screen-share) extension. Same story as .share — its App Group
# capability (group.com.bizgaze.connect) must be enabled MANUALLY on the App ID in the Apple
# Developer portal (fetch-signing-files registers the id + profile but does NOT toggle App Group).
app-store-connect fetch-signing-files "${BUNDLE_ID}.broadcast" \
--type IOS_APP_STORE \
--certificate-key="@env:CERTIFICATE_PRIVATE_KEY" \
--create
keychain add-certificates
# (No "Install CocoaPods" step under SPM — there is no Podfile. Xcode resolves the Swift packages