SMeetingEngine. For usage, see Media control and Video rendering.
NativeVideoView is an alias the SDK defines for rendering views; the actual type is SRTC’s SRTCVideoRenderer.
Camera
requestOpenCamera(view:deviceId:preset:byAdmin:adminUid:publish:)
Turns on the camera: asks the meeting for permission → starts capture → publishes. With publish: false it only captures for a preview, for device checks and settings page previews.
Returns:
LocalCameraTrack (you can ignore it, or read meeting.cameraTrack at any time)
Throws:
SMeetingError.unauthorized—the room has camera off for everyone with members not allowed to turn cameras back on themselves, and you’re not the host / a co-host (not thrown withpublish: false)SMeetingError.apiError(code:message:)- Underlying errors when capture or publishing fails (the SDK has already rolled back automatically, so you don’t need to call
closeCamera())
deviceId, it switches to the target device.
Behavior of publish: false:
- It doesn’t ask the meeting for permission, doesn’t publish, and doesn’t fire camera state events; it works before and during a meeting. The host turning off your camera or disabling cameras for everyone doesn’t affect a preview-only track
- Calling it again later with
publish: true“promotes” this track: it asks the meeting for permission and publishes the same track, without restarting capture - If the camera is already open as the meeting camera, calling it with
publish: falsejust returns the track in use - Use
isCameraOpenedto tell the two states apart; always close withcloseCamera()(no “closed” event is fired for a preview-only camera)
publish: true before entering a meeting, calling it again after entering publishes it to the meeting.
closeCamera()
userCameraStateDidChange.
switchCamera(deviceId:)
Returns: None
Throws:
SMeetingError.invalidState(_:)—the camera isn’t on yet (deviceError in 1.3.10 and earlier)
Microphone
requestOpenMic(deviceId:preset:byAdmin:adminUid:)
Returns:
LocalMicTrack (returned since 1.9.0; you can ignore it)
Throws:
SMeetingError.unauthorized—the room has mute all on with members not allowed to unmute themselves, and you’re not the host / a co-hostSMeetingError.apiError(code:message:)- Underlying errors when capture or publishing fails (the SDK rolls back automatically)
publish: false: on Apple platforms the microphone stays muted until it is published, and the recording pipeline outside a meeting doesn’t start until you enter one, so testing the mic outside a meeting or capture-only isn’t supported yet; see Device checks.
closeMic()
userMicStateDidChange.
Screen sharing
Change in 1.3.5: themessageOnlyparameter and its mode have been removed fromrequestShare. To broadcast only the sharing status, userequestShare(shareType: .whiteBoard); screen sharing still performs normal media capture and publishing. RemovemessageOnly: truefrom old code or switch to whiteboard sharing.
requestShare(shareType:preset:audioPreset:view:byAdmin:adminUid:)
Returns: None
Throws:
SMeetingError.unauthorized—the room has sharing disabled, and you’re not the host / a co-hostSMeetingError.invalidState(_:)—you’re already sharingSMeetingError.apiError(code:message:)- Underlying errors when capture fails (for example, the user denied screen recording permission)
shareType is .whiteBoard, no media stream is created; it only broadcasts the sharing status and triggers roomShareDidStart.
requestShare(source:preset:audioPreset:view:byAdmin:adminUid:excludedWindowIds:excludesCurrentApplication:)
An overload that specifies the capture source, macOS 12.3 and later only.
Returns: None
Throws: Same as the previous overload.
The computer’s audio comes from the same capture as the picture: it is published with the share and stops with
stopShare(). If publishing the audio fails, the share just continues without audio; the picture isn’t affected.
stopShare()
View capture
The following APIs are available since 1.3.4. The caller is responsible for rendering the view intoCVPixelBuffers and pushing frames continuously; the SDK only creates and publishes the video track, and doesn’t grab frames from the view itself or save a local recording file.
startViewCaptureShare()
LocalVideoTrack, with the track description screen and a degradation preference that maintains resolution. Calling it again returns the existing track.
Throws:
SMeetingError.notInMeeting—you haven’t entered a meeting yet.SMeetingError.invalidState(_:)—screen sharing is in progress (published). Having only calledprepareBroadcastShareto keep a broadcast listener ready, before the user starts broadcasting, doesn’t count: since 1.5.2 you can start view capture in that case (1.5.1 and earlier also threw here).- Underlying track publishing errors.
requestShare()’s flow of asking the meeting backend and notifying the sharing status. The caller should manage the sharing status according to its own business logic and make sure view capture and screen sharing are mutually exclusive; to switch to screen sharing, stop view capture first.
stopViewCaptureShare()
stopShare() can’t be used instead.
iOS full-screen sharing
The following APIs are available on iOS only and are used to share the entire system screen (on iOS,requestShare() can capture only your own app’s content). You must integrate a Broadcast Upload Extension first; for the full steps, see Screen sharing.
prepareBroadcastShare(appGroup:preset:)
Sets up the listener for full-screen capture and waits for the user to start broadcasting from the system UI. It doesn’t notify the meeting backend or publish a track—sharing hasn’t started yet at this point. Just call it after entering the meeting; it returns idempotently if already listening or already sharing.
Returns: None
Throws: Underlying errors when the capture listener fails to be set up (for example, an incorrect App Group configuration).
publishBroadcastShare(view:byAdmin:adminUid:)
Publishes the full-screen capture that’s already producing frames to the meeting (backend + underlying SRTC channel). Call it after receiving
shareBroadcastDidStart—that’s the moment the user actually starts sharing. It returns idempotently if already published.
Returns: None
Throws:
SMeetingError.invalidState(_:)—prepareBroadcastSharehasn’t been called yetSMeetingError.unauthorized—the room has sharing disabled, and you’re not the host / a co-hostSMeetingError.apiError(code:message:)
stopBroadcastListening()
stopShare(), and the listener won’t be set up again automatically afterward. exitRoom() calls it automatically.
Returns: None; doesn’t throw.
requestShare(broadcastAppGroup:preset:view:byAdmin:adminUid:)
isShareBroadcastActive
Bool (read-only)
Whether iOS full-screen sharing is actually producing frames right now. After prepareBroadcastShare, this property stays false until the user taps “Start Broadcast” in the system pill. It’s always false in in-app capture mode.
Remote video
subscribeRemoteVideoTrack(uid:trackDesc:)
Subscribes to a remote video track without binding a renderer view.
Returns:
RemoteVideoTrack
Throws:
SMeetingError.notInMeetingSMeetingError.remoteTrackUnavailable(uid:desc:)—the member doesn’t have this track
unsubscribeRemoteVideoTrack(uid:trackDesc:)
Unsubscribes unconditionally, regardless of whether any renderer view is still using it.
Returns: None
Throws:
SMeetingError.notInMeeting. Returns silently when the track doesn’t exist.
startPlayRemoteVideo(view:uid:trackDesc:)
Subscribes and binds the video to the renderer view you pass in; suited to UIKit / AppKit.
Returns:
RemoteVideoTrack
Throws: Same as subscribeRemoteVideoTrack(uid:trackDesc:)
stopPlayRemoteVideo(view:uid:trackDesc:)
Unbinds the renderer view. It actually unsubscribes only when the track no longer has any renderer view.
Returns: None
Throws:
SMeetingError.notInMeeting
Remote audio
Remote audio is already subscribed automatically when you enter the meeting; the following APIs are for scenarios that need fine-grained control.subscribeRemoteAudioTrack(uid:trackDesc:)
Returns: None
Throws:
SMeetingError.notInMeeting, SMeetingError.remoteTrackUnavailable(uid:desc:) (the member doesn’t have this track)
unsubscribeRemoteAudioTrack(uid:trackDesc:)
Same parameters as above. Returns silently when the track doesn’t exist.
toggleRemoteAudioMute(_:)
The master switch for remote audio playback; it only toggles playback and doesn’t change subscriptions.
Returns: None; doesn’t throw.
Composite video (MCU)
The composite video is produced by the server-side composite task (McuTaskType.mix of mcuStart) and published under the reserved identity __mcu__. It doesn’t belong to any in-meeting member, so none of these methods take a uid. The composite task must be running first: if the task starts later than your subscription, subscribe again (idempotent) after roomMcuTask reports the composite task as running.
subscribeRemoteVideoMcu()
Subscribes to the server-side composite video (since 1.5.1). In SwiftUI, pass the returned track to SRTCVideoView(track:).
Returns: RemoteVideoTrack. Repeated calls return the same track, which you can also get through meeting.mcuTrack. Receive status is reported through didChangeReceiveStreamStatus with uid set to "__mcu__".
Throws: SMeetingError.notInMeeting
unsubscribeRemoteVideoMcu()
Unsubscribes from the server-side composite video; returns immediately if you never subscribed (since 1.5.1).
startPlayRemoteVideoMcu(view:)
Subscribes to and plays the server-side composite video (UIKit / AppKit convenience method, since 1.5.1). view must already be in the view hierarchy.
Returns:
RemoteVideoTrack
Throws: SMeetingError.notInMeeting
startPlayRemoteVideoMcu(view:uid:) (deprecated)
Deprecated since 1.5.1. uid is no longer used; equivalent to startPlayRemoteVideoMcu(view:). It used to look up the composite video as some member’s camera track, which can’t be found in the current pipeline, so it always threw remoteTrackUnavailable.
stopPlayRemoteVideoMcu(view:)
Returns: None