Skip to main content

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
The naming follows one clear rule: turn-on APIs include 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

If the microphone is already on and you call it again with a different 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

  • view is needed only in UIKit / AppKit, and it must be an SRTCVideoRenderer that is already attached to the view hierarchy. In SwiftUI, always pass nil and hand meeting.cameraTrack to SRTCVideoView(track:)
  • preset takes values from SRTC’s CameraPreset: .h180p, .h360p, .h720p (default), .h1080p

Replace the preview view (UIKit / AppKit, 1.3.8+)

UIKit hosts often destroy and recreate the view that hosts the preview when the layout changes (rebuilding the grid, switching between the first screen and the video wall). Once the view is recreated, the renderer is still attached to the old view, and the local video goes black. 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

Calling it while the camera is off throws 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:
In addition, when the host turns on “mute all” during the meeting, the SDK automatically turns off the microphones of non-host members and reports 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:
To accept, pass byAdmin together with adminUid to the turn-on API:
To decline, call the corresponding reject API:
If you pass byAdmin: true, you must also pass adminUid; otherwise the call doesn’t carry the “respond to the request” semantics.
The 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 reports 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”:
This method only toggles playback and doesn’t unsubscribe, so switching back and forth has no renegotiation cost. If you really need fine-grained, per-member control over subscriptions (for example, to listen to only a few streams), use:

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: