Skip to main content
SMeetingEngine is the SDK’s only public entry point. Create only one instance per app and hold it globally. This page covers initialization, authentication, meeting management, entering and exiting meetings, state queries, in-meeting member actions, and out-of-meeting messages. For media APIs, see Media control; for devices, see Devices; for host and management APIs, see Meeting management.

Initialization

init(logLevel:)

Creates an SDK instance.

Properties

version

The SDK version number, of type String; a static property.

language

SDK language, of type String? (such as "en" or "zh-CN"). Defaults to nil, which follows the system language. Available since 1.4.0. This is the same process-wide setting as the SRTC layer’s language: requests from both the meeting layer and the RTC layer to the backend carry Accept-Language, and the messages of backend business errors (codes ≥ 1000) come back in Chinese or English accordingly. The SDK’s own errors (SMeetingError.message / SRTCError.message) are always in English and aren’t affected. Set it before login; changing it later takes effect immediately for subsequent requests.

currentLanguage

The language actually in effect, of type String, read-only: language if it’s set, otherwise the system’s preferred language, or "zh" if that can’t be determined. Available since 1.4.0. For error codes and how to handle them, see Error handling.

delegates

The collection of event delegates, of type MulticastDelegate<SMeetingDelegate>. A weak-reference multicast that supports multiple observers.

currentUserId

The ID of the currently logged-in user, of type String?; nil when not logged in.

isInRoom

Whether you’re currently in a meeting, of type Bool.

cameraTrack / screenTrack / mcuTrack

The local camera track (LocalCameraTrack?), the local screen sharing track (LocalScreenTrack?), and the remote composite track (RemoteVideoTrack?). Each is nil when the corresponding capability isn’t on.

isCameraOpened

Whether the camera is open as the meeting camera, of type Bool, read-only. Available since 1.9.0. During a preview-only requestOpenCamera(publish: false), cameraTrack isn’t nil but this property is false. Use it to tell “opened for preview” apart from “actually on in the meeting”, and decide whether to call closeCamera() when closing the preview:

Authentication

login(token:)

Logs in to the conferencing SDK. You can call the other APIs only after logging in.
Returns: None Throws:
  • SMeetingError.tokenInvalid—the token format can’t be parsed
  • SMeetingError.tokenExpired—the token has expired
  • SMeetingError.apiError(code:message:)—the server rejected the login
  • SMeetingError.networkError(_:)

logout()

Logs out. If still in a meeting, it first exits the meeting automatically, and it disables the out-of-meeting message path.
Returns: None; doesn’t throw.

Meeting management (before the meeting)

The following APIs require only login, not being in a meeting.

createRoom(_:)

Creates a meeting.
Returns: (roomNo: String, meetingId: String) Throws: SMeetingError.notLoggedIn, SMeetingError.apiError(code:message:)
If meetingType isn’t set explicitly, an instant meeting is created.

updateRoom(meetingId:req:)

Updates a meeting (before the meeting).
Returns: None Throws: SMeetingError.notLoggedIn, SMeetingError.apiError(code:message:)

cancelRoom(meetingId:)

Cancels a meeting.
Returns: None Throws: SMeetingError.notLoggedIn, SMeetingError.apiError(code:message:)

detailRoom(meetingId:roomNo:)

Gets meeting details; provide one of the two parameters.
Returns: MeetingInfo. The detail response has no creation time, so createdAt is 0; since 1.5.0 it also carries entryMutePolicy and content (nil when the backend doesn’t return them). See Types for fields Throws: SMeetingError.notLoggedIn, SMeetingError.apiError(code:message:)

attendeeRoom(page:)

Meetings you need to attend (not started yet or in progress).
Returns: PageResult<MeetingInfo> Throws: SMeetingError.notLoggedIn, SMeetingError.apiError(code:message:)

attendedRoom(page:)

Past meetings. Parameters and return value are the same as attendeeRoom(page:).

roomParticipant(meetingId:page:perPage:)

Attendance records of a meeting.
Returns: PageResult<ParticipantInfo> Throws: SMeetingError.notLoggedIn, SMeetingError.apiError(code:message:)

Enter / exit a meeting

enterRoom(_:)

Enters a meeting.
Returns: None Throws:
  • SMeetingError.notLoggedIn
  • SMeetingError.alreadyInMeeting—already in a meeting; call exitRoom() first
  • SMeetingError.apiError(code:message:)—wrong password, meeting doesn’t exist, entry restricted, and so on
    • code == SMeetingError.waitingRoomCode (2118): moved into the waiting room; code == SMeetingError.enterBeforeHostCode (2120): must wait for the host to join. Neither is a failure—show a waiting page; see Waiting room (constants since 1.14.0)
  • Errors thrown when the underlying connection fails to be set up
On success, the SDK subscribes to remote audio automatically; video is subscribed on demand.

exitRoom()

Exits the current meeting; the login state is kept.
Returns: None; doesn’t throw. Calling it when not in a meeting is safely ignored.

State queries

getRoomInfo()

Returns: RoomInfo?; nil when not in a meeting.

getWhiteBoard()

Returns: String?, the whiteboard URL of the current meeting; nil if there is none.

getUserInfo(_:)

Returns: MeetingUserInfo Throws: SMeetingError.notInMeeting, SMeetingError.userNotFound(_:) (no such member in the meeting)

getUsersInfo()

Returns: [String: MeetingUserInfo], a map from uid to member; an empty dictionary when not in a meeting.

getUsersInfoList()

Returns: [MeetingUserInfo]; an empty array when not in a meeting.

getRemoteVideoTrack(uid:desc:)

Looks up the track object of a given video track of a member, without subscribing. Returns: Track?; nil when the member doesn’t exist or hasn’t published that track.

In-meeting member actions

The following APIs all require being in a meeting; otherwise they throw SMeetingError.notInMeeting. When the server rejects the call, they throw SMeetingError.apiError(code:message:).

updateName(_:)

Changes your own in-meeting display name.

sendRoomChatMessage(_:type:targetId:)

Sends an in-meeting chat message.

sendRoomCustomMessage(_:targetId:)

Sends a custom message of your own.

requestHandup(_:) / cancelHandup(_:)

Raises a hand or cancels it.

rejectOpenMic(adminUid:) / rejectOpenCamera(adminUid:)

Declines the host’s request to turn on the microphone / camera.

rollCallAnswer(rollCallUserId:)

Answers a roll call. Throws: SMeetingError.notLoggedIn, SMeetingError.apiError(code:message:)

Out-of-meeting messages

enableIm()

Enables the out-of-meeting message path.
After it succeeds, meeting(_:imDidConnect:) fires once. Subsequent out-of-meeting messages are dispatched by action to imCallCalling / imMeetingRemind / imAdminMoveOutWaitingRoom / imUserHelpSubMeeting, and every message also fires imDidReceiveMessage as is; see Out-of-meeting messages. In 1.4.1 and earlier these events were never actually dispatched; fixed in 1.5.0. Returns: None Throws: SMeetingError.notLoggedIn, SMeetingError.apiError(code:message:), and underlying errors when the connection fails to be set up

disableIm()

Disables the out-of-meeting message path.
Returns: None; doesn’t throw. logout() calls it internally. Disabling it yourself doesn’t fire meeting(_:imDidDisconnect:).

Pre-call network check

Available since 1.11.0, requires SRTC 1.10.0. Call it before joining; you don’t need to join a meeting or connect to RTC. It has the same name and parameters as SRTC’s networkCheck: SRTC runs the five checks permission → connectivity → mtu → dns → server and its results are converted to meeting-layer types as is. The meeting layer only adds one subcheck, meetingApi (JSON key meeting_api, whether the meeting API is reachable), to the data of the server item, and recomputes the overall status accordingly. When everything is normal it takes about 1–5 seconds.

networkCheck(timeoutMs:onItem:)

Use this when logged in: the RTC app_id and server address come from the login information (from the IM token if enableIm() has been called; otherwise derived from the meeting API address), so you don’t pass any.
Returns: MeetingNetworkCheckResult (async throws) Throws: SMeetingError.notLoggedIn (not logged in), SRTCError.invalidArgument (the RTC address can’t be derived; use the overload below that takes explicit parameters), .alreadyJoined (a check is already running), .cancelled (cancelled)

networkCheck(appId:serverUrl:timeoutMs:onItem:)

Use this when not logged in: pass the RTC app ID and server address explicitly. Everything else is the same as above. When logged in, meeting_api probes the meeting API used for login; when not logged in, the meeting API address is derived from serverUrl, and if it can’t be derived, meeting_api is skipped (server_info_unavailable).

networkCheck(token:timeoutMs:onItem:)

A shortcut when you already have an RTC channel token or IM token: only its app_id and client_api are used, not for authentication, so an expired token also works. Throws SRTCError.invalidArgument if the token can’t be decoded.

cancelNetworkCheck()

Cancels the check running on this instance; the running networkCheck then throws SRTCError.cancelled. Does nothing if no check is running.

Rules and errors

  • How meeting_api is judged: it makes one signed call to a read-only meeting API, and any HTTP response counts as reachable; a network error or timeout counts as unreachable, in which case server is fail with reason meeting_api_unreachable. If server has already failed because of an SRTC subcheck, SRTC’s reason is kept.
  • Duration: meeting_api runs in parallel with the SRTC checks, so it doesn’t add to the total duration.
  • What the other items check, their reason codes, and platform limitations are the same as in SRTC; see SRTC types.
The first three are SRTC-layer errors passed through, with the same codes as when you call SRTC directly; only “not logged in” uses the meeting layer’s SMeetingError.

Virtual background

iOS only: starting with 1.7.0, these members don’t exist on macOS; wrap code shared by both platforms in #if os(iOS). This is a device-level setting (it applies to the single shared camera capture pipeline in the process), and it applies to all meetings at once. After switching cameras, turning the camera off and on again, or reconnecting after a disconnect during the meeting, your app doesn’t need to apply it again. For usage and tuning, see Virtual background. Throws: SRTCError.virtualBackgroundAlreadyInstalled, .virtualBackgroundNotInstalled, .virtualBackgroundModelNotFound(String), .virtualBackgroundSessionFailed(String) This group forwards to the audio and video layer, and the meeting layer doesn’t keep a separate copy of the state.

Audio and video processing

The following APIs are available since 1.9.0. They forward to the same-named SRTC APIs, and the meeting layer doesn’t keep a separate copy of the state.

audioCaptureProcessor

The microphone capture processor, of type AudioProcessor?; nil clears it. The most common use is attaching the SRTC AI noise suppression plugin; see AI noise suppression (DeepFilterNet).
  • The SDK holds the processor weakly: keep your own reference to the processor; otherwise it’s released immediately and processing silently stops working.
  • Global; only one can be attached at a time, and you can set it at any time before or after entering a meeting.
  • When the processor conforms to AudioProcessingDeclaring (for example, the noise suppression plugin declares that built-in noise suppression should be off), the SDK turns off the corresponding WebRTC software processing as declared and restores it when cleared.

defaultVideoProcessors

Engine-level default video processors (beauty filters and so on), of type [VideoProcessor]. They apply automatically to camera tracks created from then on.
A new camera track is created every time the camera is turned on, so processors attached only to cameraTrack?.videoProcessors are gone the next time; put “set it once” processors here.