MediaSFU for Swift and Apple platforms
Essential next steps
- API and reference documentation
- Choose standard, hybrid, or fully headless UI
- Headless and hybrid implementation
- Starter projects and showcases
- Framework examples and recipes
- Current release and migration notes
- Troubleshooting and recovery
Build a native MediaSFU room for iPhone, iPad, and Mac. The Apple release combines MediaSFUAppleSDK 0.1.3 with the MediaSFUSDK 1.0.3 room framework. The Apple package connects native media to the room framework; MediaSFUIosHostBridge presents the complete room experience from Swift.
For an isolated local prototype, use only restricted, revocable development
credentials and never commit them. Before sharing or releasing a Cloud-backed
app, use the production credential boundary. The
current Apple launch configuration does not provide a credential-free Cloud
grant callback, so a released app must not contain apiUserName or apiKey.
Install
In Xcode, add this Swift package and select the MediaSFUAppleSDK product:
https://github.com/MediaSFU/mediasfu-apple-sdk.git
Select release 0.1.3. The release also provides MediaSFUSDK-1.0.3.xcframework.zip; add that XCFramework to the application target and select Embed & Sign. Your Swift target can then import both modules:
import MediaSFUAppleSDK
import MediaSFUSDK
The media transport package is an implementation dependency of MediaSFUAppleSDK. It is not a separate MediaSFU SDK choice.
Add Apple permissions
Add camera and microphone descriptions to Info.plist before enabling local media:
<key>NSCameraUsageDescription</key>
<string>Use the camera during calls and meetings.</string>
<key>NSMicrophoneUsageDescription</key>
<string>Use the microphone during calls and meetings.</string>
Screen sharing on iOS also requires a ReplayKit broadcast upload extension. Add that extension before enabling screen sharing in a shipping app.
Copy/paste starter
This complete SwiftUI wrapper joins an approved room on your self-hosted MediaSFU server. Replace the server URL, room name, and display name with values supplied by your app.
import SwiftUI
import UIKit
import MediaSFUAppleSDK
import MediaSFUSDK
struct MediaSFURoomView: UIViewControllerRepresentable {
let serverURL: String
let roomName: String
let displayName: String
func makeUIViewController(context: Context) -> UIViewController {
let bridge = MediaSFUIosHostBridge()
let config = bridge.makeLaunchConfig()
config.localLink = serverURL
config.connectMediaSFU = true
config.action = "join"
config.eventType = "conference"
config.roomName = roomName
config.userName = displayName
config.autoProceed = false
return bridge.makeHostViewController(config: config)
}
func updateUIViewController(
_ uiViewController: UIViewController,
context: Context
) {}
}
struct MeetingScreen: View {
var body: some View {
MediaSFURoomView(
serverURL: "https://media.example.com",
roomName: "weekly-product-room",
displayName: "Ada"
)
.ignoresSafeArea()
}
}
The hosted room supplies participant rendering, microphone and camera controls, remote media, screen sharing, and the normal leave flow. Set eventType to conference, webinar, broadcast, or chat to choose the room experience.
Control the hosted room from Swift
Keep the MediaSFUIosHostBridge instance when your own Swift controls need to open a MediaSFU panel or toggle local media:
final class RoomControls {
let bridge = MediaSFUIosHostBridge()
func toggleMicrophone() {
bridge.triggerToggleAudio()
}
func toggleCamera() {
bridge.triggerToggleVideo()
}
func toggleScreenShare() {
bridge.triggerToggleScreenShare()
}
func showParticipants() {
bridge.triggerShowModal(name: "participants")
}
}
Use the hosted room for the first integration. The lower-level bridge types are intended for applications that deliberately own their transport, producer, and consumer lifecycle.
Before release
- Confirm that
MediaSFUAppleSDK0.1.3andMediaSFUSDK1.0.3are embedded in the application target. - Test microphone, camera, remote audio/video, rotation, background/foreground transitions, screen sharing, leave, and cleanup on the oldest and newest Apple devices you support.
- Verify denied permissions and an interrupted network produce a useful recovery path.
- Keep Cloud account credentials off the device. Use the self-hosted flow above until your application has an approved credential-free Cloud room handoff.
The Windows documentation build can validate this page and its referenced symbols, but the final Xcode build and Apple-device checks must run on macOS.
Features your Apple app owns
The hosted Apple room includes participant, chat, poll, waiting-room, breakout, whiteboard, recording-control, device, and media-control panels. Use those hosted controls first. The Apple composition does not publish a separate Swift operation API for these application and backend services:
- Cloud room creation through a credential-free grant, invite redemption, durable bans, role policy, and a product-specific host-end rule;
- an independent Swift headless action for semantic host end or host leave-without-ending; dismissing the hosted view proves neither outcome;
- reconnect and cleanup policy, device-selection UI, and the recovery messages your users see after a denied permission or interrupted connection;
- file sharing, recording storage or exports, SIP/PSTN, HLS/WHEP/WHIP, and AI-agent handoff;
- a fully headless operator console or custom media renderer. Use the hosted room first; replacing it means your app owns the missing UI and lifecycle.
MediaSFU can be part of each of those experiences, while your product retains responsibility for authorization, consent, retention, business rules, and the customer-facing experience.