Skip to main content
The APIs on this page are all on 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:)

Turns on the camera: asks the meeting for permission → starts capture → publishes.
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
  • 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())
Calling it again while the camera is already on doesn’t start another stream; if you pass a different deviceId, it switches to the target device.

closeCamera()

Returns: None; doesn’t throw. It unpublishes, removes the renderer views, stops capture, and reports userCameraStateDidChange.

switchCamera(deviceId:)

Returns: None Throws: SMeetingError.deviceError(_:)—the camera isn’t on yet

Microphone

requestOpenMic(deviceId:preset:byAdmin:adminUid:)

Returns: None Throws:
  • SMeetingError.unauthorized—the room has mute all on with members not allowed to unmute themselves, and you’re not the host / a co-host
  • SMeetingError.apiError(code:message:)
  • Underlying errors when capture or publishing fails (the SDK rolls back automatically)

closeMic()

Returns: None; doesn’t throw. It unpublishes, stops capture, and reports userMicStateDidChange.

Screen sharing

Change in 1.3.5: the messageOnly parameter and its mode have been removed from requestShare. To broadcast only the sharing status, use requestShare(shareType: .whiteBoard); screen sharing still performs normal media capture and publishing. Remove messageOnly: true from old code or switch to whiteboard sharing.

requestShare(shareType:preset:view:byAdmin:adminUid:)

Returns: None Throws:
  • SMeetingError.unauthorized—the room has sharing disabled, and you’re not the host / a co-host
  • SMeetingError.internalError(_:)—you’re already sharing
  • SMeetingError.apiError(code:message:)
  • Underlying errors when capture fails (for example, the user denied screen recording permission)
When shareType is .whiteBoard, no media stream is created; it only broadcasts the sharing status and triggers roomShareDidStart.

requestShare(source:preset: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.
Since 1.3.2 (SRTC 1.4.2), whole-screen sharing includes your app’s own windows by default. The main in-meeting window is usually rendering remote video; if your UI has a sharing preview, or you’re testing with two instances on the same machine, be sure to put these windows into excludedWindowIds; otherwise you get an infinite mirror.

stopShare()

Returns: None; doesn’t throw.

View capture

The following APIs are available since 1.3.4. The caller is responsible for rendering the view into CVPixelBuffers 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()

Parameters: None. Returns: The published 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.internalError(_:)—a screen sharing track already exists, including a broadcast listening track that’s been prepared but not yet published.
  • Underlying track publishing errors.
This API publishes the media track directly, without going through 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()

Parameters: None. Returns: None; doesn’t throw. It tries to unpublish and clears the track and its renderers, without turning off or unpublishing the microphone track. The caller should also stop pushing frames. View capture must be ended through this API; 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.internalError(_:)—prepareBroadcastShare hasn’t been called yet
  • SMeetingError.unauthorized—the room has sharing disabled, and you’re not the host / a co-host
  • SMeetingError.apiError(code:message:)
When publishing fails, the SDK rolls back the sharing status automatically.

stopBroadcastListening()

Stops listening for full-screen capture. Calling it while sharing is equivalent to 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:)

The one-step version: announces sharing to the meeting at the same time as setting up the listener.
The user may never tap the system pill, in which case the meeting is left with a sharing flag that has no video, and you have to withdraw it yourself with a timeout. For meeting scenarios, use prepareBroadcastShare + publishBroadcastShare; this overload is kept only for simple integrations that “don’t care about the intermediate state.”

isShareBroadcastActive

Type: 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.notInMeeting
  • SMeetingError.internalError(_:)—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.internalError(_:)

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)

startPlayRemoteVideoMcu(view:uid:)

Subscribes to and plays the server-side composite video. Requires the server to have a composite task set up. Returns: RemoteVideoTrack Throws: SMeetingError.notInMeeting, SMeetingError.internalError(_:) (composite video track not found)

stopPlayRemoteVideoMcu(view:)

Returns: None