Overview
Media control in a meeting has three parts:- Local capture and publishing: camera, microphone, screen sharing
- Remote playback: the master switch for remote audio, remote video subscription
- Room policies: mute all / camera off for everyone / sharing disabled set by the host directly decide whether you can turn media on
request, turn-off APIs don’t.
The turn-on APIs are marked
throws (they can be rejected by room policies or fail to capture); the turn-off APIs never throw, so you can call them directly.
Microphone
Turn on and off
requestOpenMic does the following in order: asks the meeting for permission to turn on the microphone → starts local microphone capture → publishes to the meeting → emits the userMicStateDidChange event.
Specify a device and audio preset
deviceId, the SDK switches directly to the target device instead of ignoring the call.
preset takes values from SRTC’s MicPreset: .speech, .music (default), .musicStereo, .musicHighQuality, .musicHighQualityStereo.
Camera
Turn on and off
requestOpenCamera returns a LocalCameraTrack; you can also get it at any time through meeting.cameraTrack (nil when the camera is off).
Parameters
viewis needed only in UIKit / AppKit, and it must be anSRTCVideoRendererthat is already attached to the view hierarchy. In SwiftUI, always passniland handmeeting.cameraTracktoSRTCVideoView(track:)presettakes values from SRTC’sCameraPreset:.h180p,.h360p,.h720p(default),.h1080p
Replace the preview view (UIKit / AppKit, 1.3.8+)
updateLocalCameraView(_:) moves the renderer to the new view without interrupting capture, so you don’t need to turn the camera off and on again.
Calling requestOpenCamera(view:) while the camera is already on also moves the renderer to the newly passed view (since 1.3.8; before that, the new view was silently ignored).
Switch cameras
SMeetingError.deviceError.
How room policies affect turning media on
The host can set room-level media policies that directly decide whether regular members can turn media on themselves:
When “mute all” and “members aren’t allowed to unmute themselves” are both
true, and you’re not the host / a co-host, requestOpenMic() throws SMeetingError.unauthorized. The same applies to the camera.
We recommend reflecting this state in the UI in advance, rather than letting users tap the button and then get an error:
userMicStateDidChange once (with byAdmin set to true). The same applies to the camera.
Respond to the host’s turn-on requests
The host can ask a member to turn on their microphone or camera, and the member receives an event:byAdmin together with adminUid to the turn-on API:
If you passThe host can also directly turn off a member’s microphone / camera. The affected member doesn’t need to handle anything: the SDK stops the stream automatically and reportsbyAdmin: true, you must also passadminUid; otherwise the call doesn’t carry the “respond to the request” semantics.
userMicStateDidChange / userCameraStateDidChange (with byAdmin set to true and opUid set to the operator).
Remote audio
Remote audio is subscribed automatically when you enter the meeting, so you usually need only a “speaker switch”:Clean up before exiting the meeting
exitRoom() exits the meeting, but we recommend turning off local capture explicitly so that the UI state and the hardware state are both reset: