Publish and Subscribe

enableDualStreamMode [1/2]

Enables or disables dual-stream mode on the sender side.

virtual int enableDualStreamMode(bool enabled) __deprecated = 0;
Deprecated
Deprecated since v4.2.0. Use setDualStreamMode instead.

Dual-stream mode consists of a high-quality (high bitrate, high resolution) and a low-quality (low bitrate, low resolution) video stream. After enabling dual-stream mode, you can call setRemoteVideoStreamType to select the high or low-quality stream on the receiver side.

Note:
  • This method applies to all types of video streams on the sender side, including but not limited to camera capture, screen sharing, and custom video streams.
  • To enable dual-stream mode in multi-channel scenarios, use enableDualStreamModeEx.
  • You can call this method before or after joining a channel.

Parameters

enabled
Whether to enable dual-stream mode:
  • true: Enable dual-stream mode.
  • false: (default) Disable dual-stream mode.

Return Values

  • 0: Success.
  • < 0: Failure.

enableDualStreamMode [2/2]

Sets the dual-stream mode and low-quality stream on the sender side.

virtual int enableDualStreamMode(bool enabled, const SimulcastStreamConfig& streamConfig) __deprecated = 0;
Deprecated
Deprecated since v4.2.0. Use setDualStreamMode instead.
You can call this method to enable or disable dual-stream mode on the sender side. Dual-stream mode means sending both high-quality and low-quality video streams:
  • High-quality stream: high bitrate and resolution.
  • Low-quality stream: low bitrate and resolution.
After enabling dual-stream mode, you can call setRemoteVideoStreamType to select the high or low-quality stream on the receiver side.
Note:
  • This method applies to all types of video streams on the sender side, including but not limited to camera capture, screen sharing, and custom video streams.
  • To enable dual-stream mode in multi-channel scenarios, use enableDualStreamModeEx.
  • You can call this method before or after joining a channel.

Parameters

enabled
Whether to enable dual-stream mode:
  • true: Enable dual-stream mode.
  • false: (default) Disable dual-stream mode.
streamConfig
Configuration for the low-quality stream. See SimulcastStreamConfig.
Note: When mode is set to DISABLE_SIMULCAST_STREAM, streamConfig has no effect.

Return Values

  • 0: Success.
  • < 0: Failure.

enableDualStreamModeEx

Enables or disables video streams with different quality levels on the sender side.

virtual int enableDualStreamModeEx(bool enabled, const SimulcastStreamConfig& streamConfig, const RtcConnection& connection) = 0;
Deprecated
Deprecated since v4.2.0. Use setDualStreamModeEx instead.

Video streams with different quality levels consist of a pair of high-quality (high bitrate, high resolution) and low-quality (low bitrate, low resolution) streams. After enabling this feature, you can call the setRemoteVideoStreamType method on the subscriber side to choose to receive either high- or low-quality video streams.

Note: This method applies to all types of video streams on the sender side, including but not limited to camera-captured streams, screen sharing streams, and custom captured streams.

Scenario

This method is applicable in multi-channel scenarios.

Parameters

enabled
Whether to enable video streams with different quality levels:
  • true: Enable.
  • false: (Default) Disable.
streamConfig
Configuration for the low-quality stream. See SimulcastStreamConfig.
Note: When mode is set to DISABLE_SIMULCAST_STREAM, setting streamConfig has no effect.
connection
Connection information. See RtcConnection.

Return Values

  • 0: Success.
  • < 0: Failure.

muteAllRemoteAudioStreams

Stops or resumes receiving all remote audio streams.

virtual int muteAllRemoteAudioStreams(bool mute) = 0;

This method stops or resumes receiving audio streams from all remote users who have joined or will join the channel via joinChannel. It is equivalent to autoSubscribeAudio in ChannelMediaOptions.

Note: Make sure to call this method after joining the channel. If you call muteAllRemoteAudioStreams(true) after joining, the local user stops receiving audio streams from all users in the channel, including those who join after the call.

Parameters

mute
Whether to stop receiving all remote audio streams:
  • true: Stop receiving.
  • false: Resume receiving.

Return Values

  • 0: Success.
  • < 0: Failure.

muteAllRemoteAudioStreamsEx

Stops or resumes subscribing to all remote users' audio streams.

virtual int muteAllRemoteAudioStreamsEx(bool mute, const RtcConnection& connection) = 0;

After you call this method, the local user stops or resumes subscribing to all remote users' audio streams, including those who join the channel after this method is called.

Note: Call this method after joining a channel. If you want to avoid subscribing to remote users' audio streams before joining a channel, set autoSubscribeAudio to false in ChannelMediaOptions when calling joinChannel.

Scenario

This method applies to multi-channel scenarios.

Parameters

mute
Whether to stop subscribing to all remote users' audio streams:
  • true: Stop subscribing to all remote users' audio streams.
  • false: (Default) Subscribe to all remote users' audio streams.
connection
Connection information. See RtcConnection.

Return Values

  • 0: The method call succeeds.
  • < 0: The method call fails.

muteAllRemoteVideoStreams

Stops or resumes receiving all remote users' video streams.

virtual int muteAllRemoteVideoStreams(bool mute) = 0;

This method takes effect for all remote users who have joined or will join the channel via joinChannel, and is equivalent to autoSubscribeVideo in ChannelMediaOptions. Make sure to call this method after joining a channel.

Note: If you call muteAllRemoteVideoStreams(true) after joining a channel, the local user stops receiving all users' video streams in the channel, including those who join after the method is called.

Parameters

mute
Whether to stop receiving all remote video streams:
  • true: Stop receiving all remote video streams.
  • false: Resume receiving all remote video streams.

Return Values

  • 0: Success.
  • < 0: Failure.

muteAllRemoteVideoStreamsEx

Stops or resumes subscribing to all remote users' video streams.

virtual int muteAllRemoteVideoStreamsEx(bool mute, const RtcConnection& connection) = 0;

After you call this method, the local user stops or resumes subscribing to all remote users' video streams, including those who join the channel afterward.

Scenario

This method applies to multi-channel scenarios.

Parameters

mute
Whether to stop subscribing to all remote users' video streams.
  • true: Stop subscribing to all remote users' video streams.
  • false: (Default) Subscribe to all remote users' video streams.
connection
Connection information. See RtcConnection.

Return Values

  • 0: The method call succeeds.
  • < 0: The method call fails.

muteLocalAudioStream

Controls whether to publish the locally captured audio stream.

virtual int muteLocalAudioStream(bool mute) = 0;

When you call this method to stop publishing the local audio stream, the audio capture device continues to work and is not affected.

Timing

You can call this method before or after joining a channel.

Parameters

mute
Whether to stop publishing the local audio stream:
  • true: Stop publishing the local audio stream.
  • false: (Default) Resume publishing the local audio stream.

Return Values

  • 0: Success.
  • < 0: Failure.

muteLocalAudioStreamEx

Stops or resumes publishing the local audio stream.

virtual int muteLocalAudioStreamEx(bool mute, const RtcConnection& connection) = 0;
Note: This method does not affect ongoing audio recording because it does not disable the audio capturing device.

Scenario

This method applies to multi-channel scenarios.

Parameters

mute
Whether to stop publishing the local audio stream:
  • true: Stop publishing the local audio stream.
  • false: (Default) Resume publishing the local audio stream.
connection
Connection information. See RtcConnection.

Return Values

  • 0: Success.
  • < 0: Failure.

muteLocalVideoStream

Controls whether to publish the captured local video stream.

virtual int muteLocalVideoStream(bool mute) = 0;

This method controls whether to publish the captured local video stream. If you call this method to stop publishing the local video stream, the video capturing device continues to work normally and is not affected. Compared to disabling local video by setting enableLocalVideo to false, this method responds faster.

Timing

You can call this method before or after joining a channel.

Parameters

mute
Whether to stop publishing the local video stream.
  • true: Stop publishing the local video stream.
  • false: (Default) Publish the local video stream.

Return Values

  • 0: Success.
  • < 0: Failure.

muteLocalVideoStreamEx

Stops or resumes publishing the local video stream.

virtual int muteLocalVideoStreamEx(bool mute, const RtcConnection& connection) = 0;

This method does not affect ongoing video recording because it does not turn off the camera.

Scenario

This method applies to multi-channel scenarios.

Parameters

mute
Whether to stop publishing the local video stream.
  • true: Stop publishing the local video stream.
  • false: (Default) Publish the local video stream.
connection
Connection information. See RtcConnection.

Return Values

  • 0: Success.
  • < 0: Failure.

muteRemoteAudioStream

Stops or resumes subscribing to the audio stream of a specified remote user.

virtual int muteRemoteAudioStream(uid_t uid, bool mute) = 0;

Timing

Call this method after joining a channel.

Parameters

uid
The user ID of the specified remote user.
mute
Whether to subscribe to the audio stream of the specified remote user.
  • true: Stop subscribing to the user's audio stream.
  • false: (Default) Subscribe to the user's audio stream.

Return Values

  • 0: Success.
  • < 0: Failure.

muteRemoteAudioStreamEx

Stops or resumes receiving audio stream from a specified user.

virtual int muteRemoteAudioStreamEx(uid_t uid, bool mute, const RtcConnection& connection) = 0;

You can call this method before or after joining a channel. If the user leaves the channel, the setting becomes invalid.

Scenario

This method applies to multi-channel scenarios.

Parameters

uid
The ID of the specified user.
mute
Whether to stop receiving the audio stream from the specified user:
  • true: Stop receiving the audio stream from the specified user.
  • false: (Default) Resume receiving the audio stream from the specified user.
connection
Connection information. See RtcConnection.

Return Values

  • 0: Success.
  • < 0: Failure.

muteRemoteVideoStream

Stops or resumes subscribing to the video stream of a specified remote user.

virtual int muteRemoteVideoStream(uid_t uid, bool mute) = 0;

Timing

Call this method after joining a channel.

Parameters

uid
The user ID of the specified remote user.
mute
Whether to subscribe to the specified remote user's video stream:
  • true: Stop subscribing to the user's video stream.
  • false: (Default) Subscribe to the user's video stream.

Return Values

  • 0: Success.
  • < 0: Failure.

muteRemoteVideoStreamEx

Stops or resumes receiving video stream from a specified remote user.

virtual int muteRemoteVideoStreamEx(uid_t uid, bool mute, const RtcConnection& connection) = 0;

Scenario

This method applies to multi-channel scenarios.

Timing

You can call this method before or after joining a channel to stop or resume receiving video stream from a specified remote user. If the user leaves the channel, the setting becomes invalid.

Parameters

uid
Remote user ID.
mute
Whether to stop receiving the video stream from the specified user:
  • true: Stop receiving the video stream from the user.
  • false: (Default) Resume receiving the video stream from the user.
connection
Connection information. See RtcConnection.

Return Values

  • 0: Success.
  • < 0: Failure.

setDualStreamMode [1/2]

Sets the video stream mode on the sender side to control whether to send a low-quality stream.

virtual int setDualStreamMode(SIMULCAST_STREAM_MODE mode) = 0;

By default, the SDK enables adaptive mode (AUTO_SIMULCAST_STREAM) for the low-quality stream on the sender side, meaning the sender does not proactively send the low-quality stream. A receiver with the host role can request the low-quality stream by calling setRemoteVideoStreamType, and the sender will start sending it upon receiving the request. If you want to change this behavior, call this method and set mode to DISABLE_SIMULCAST_STREAM (never send) or ENABLE_SIMULCAST_STREAM (always send). To revert to the default behavior, call this method again and set mode to AUTO_SIMULCAST_STREAM.

Note: The difference between this method and enableDualStreamMode is:
  • Setting mode to DISABLE_SIMULCAST_STREAM is equivalent to calling enableDualStreamMode(false).
  • Setting mode to ENABLE_SIMULCAST_STREAM is equivalent to calling enableDualStreamMode(true).
  • Both methods can be called before or after joining a channel. If both are called, the later one takes effect.

Parameters

mode
The video stream mode on the sender side. See SIMULCAST_STREAM_MODE.

Return Values

  • 0: Success.
  • < 0: Failure.

setDualStreamMode [2/2]

Configures the video stream mode for different quality layers on the sender side.

virtual int setDualStreamMode(SIMULCAST_STREAM_MODE mode, const SimulcastStreamConfig& streamConfig) = 0;
By default, the SDK enables the adaptive low-quality video stream mode (AUTO_SIMULCAST_STREAM) on the sender side, meaning the sender does not actively send the low-quality stream. The receiver with the broadcaster role can request the low-quality stream by calling setRemoteVideoStreamType, and the sender will automatically start sending it upon receiving the request.
  • If you want to change this behavior, call this method and set mode to DISABLE_SIMULCAST_STREAM (never send low-quality stream) or ENABLE_SIMULCAST_STREAM (always send low-quality stream).
  • To restore the default behavior, call this method again and set mode to AUTO_SIMULCAST_STREAM.
The difference from the setDualStreamMode method (with parameter SIMULCAST_STREAM_MODE mode) is that this method also supports configuring the low-quality stream, and the SDK sends the video stream according to the configuration in streamConfig.
Note: The differences between this method and enableDualStreamMode are as follows:
  • Calling this method with mode set to DISABLE_SIMULCAST_STREAM is equivalent to calling enableDualStreamMode with enabled set to false.
  • Calling this method with mode set to ENABLE_SIMULCAST_STREAM is equivalent to calling enableDualStreamMode with enabled set to true.
  • Both methods can be called before or after joining a channel. If both are called, the later call takes precedence.

Parameters

mode
The video stream sending mode. See SIMULCAST_STREAM_MODE.
streamConfig
Configuration for the low-quality video stream. See SimulcastStreamConfig.
Note: When mode is set to DISABLE_SIMULCAST_STREAM, streamConfig has no effect.

Return Values

  • 0: Success.
  • < 0: Failure.

setDualStreamModeEx

Sets the video stream mode with multiple quality levels on the sender side.

virtual int setDualStreamModeEx(SIMULCAST_STREAM_MODE mode, const SimulcastStreamConfig& streamConfig, const RtcConnection& connection) = 0;

By default, the SDK enables the adaptive mode (AUTO_SIMULCAST_STREAM) for low-quality video streams on the sender side, meaning the sender does not proactively send low-quality video streams. Receivers with the host role can request low-quality streams by calling setRemoteVideoStreamTypeEx, and the sender will start sending them upon receiving the request. If you want to change this behavior, call this method and set mode to DISABLE_SIMULCAST_STREAM (never send low-quality streams) or ENABLE_SIMULCAST_STREAM (always send low-quality streams). To revert to the default behavior after changing it, call this method again and set mode to AUTO_SIMULCAST_STREAM.

Note: The differences between this method and enableDualStreamModeEx are as follows:
  • Calling this method with mode set to DISABLE_SIMULCAST_STREAM is equivalent to calling enableDualStreamModeEx(false).
  • Calling this method with mode set to ENABLE_SIMULCAST_STREAM is equivalent to calling enableDualStreamModeEx(true).
  • Both methods can be called before or after joining a channel. If both are called, the latter takes precedence.

Scenario

This method is applicable in multi-channel scenarios.

Parameters

mode
The sending mode for video streams. See SIMULCAST_STREAM_MODE.
streamConfig
Configuration for the low-quality stream. See SimulcastStreamConfig.
Note: When mode is set to DISABLE_SIMULCAST_STREAM, this parameter has no effect.
connection
Connection information. See RtcConnection.

Return Values

  • 0: Success.
  • < 0: Failure.

setRemoteDefaultVideoStreamType

Sets the default video stream type to subscribe to.

virtual int setRemoteDefaultVideoStreamType(VIDEO_STREAM_TYPE streamType) = 0;
Depending on the sender's default behavior and the settings when calling setDualStreamMode, the receiving client can call this method in the following scenarios:
  • By default, the SDK enables adaptive small video stream mode (AUTO_SIMULCAST_STREAM) on the sender, meaning only the high-quality stream is sent. In this case, only host-role receivers can call this method to request the low-quality stream. Once the sender receives the request, it starts sending the low-quality stream. Then all users in the channel can call this method to switch to low-quality stream subscription mode.
  • If the sender calls setDualStreamMode with mode set to DISABLE_SIMULCAST_STREAM (never send low-quality stream), this method has no effect.
  • If the sender calls setDualStreamMode with mode set to ENABLE_SIMULCAST_STREAM (always send low-quality stream), both host and audience-role receivers can call this method to switch to low-quality stream subscription mode.
The SDK dynamically adjusts the stream resolution based on the video window size to save bandwidth and computing resources. The aspect ratio of the low-quality stream is the same as the high-quality stream. The system automatically allocates resolution, frame rate, and bitrate for the low-quality stream based on the current high-quality stream's aspect ratio.
Note: If you call both this method and setRemoteVideoStreamType, the setting in setRemoteVideoStreamType takes precedence.

Timing

Call this method before joining a channel.

Parameters

streamType
The default video stream type to subscribe to. See VIDEO_STREAM_TYPE.

Return Values

  • 0: Success.
  • < 0: Failure.

setRemoteVideoStreamType

Sets the type of video stream to subscribe to.

virtual int setRemoteVideoStreamType(uid_t uid, VIDEO_STREAM_TYPE streamType) = 0;
Based on the sender's default behavior and the settings when calling setDualStreamMode, the receiver can use this method in the following scenarios:
  • By default, the SDK enables the video low stream adaptive mode (AUTO_SIMULCAST_STREAM) on the sender side, which means only the high-quality stream is sent. Only receivers with the host role can call this method to request the low-quality video stream. Once the sender receives the request, it automatically starts sending the low-quality stream. At this point, all users in the channel can call this method to switch to subscribe to the low-quality stream.
  • If the sender calls setDualStreamMode with mode set to DISABLE_SIMULCAST_STREAM (never send low-quality stream), this method has no effect.
  • If the sender calls setDualStreamMode with mode set to ENABLE_SIMULCAST_STREAM (always send low-quality stream), both host and audience roles on the receiver side can call this method to switch to subscribe to the low-quality stream.
The SDK dynamically adjusts the resolution of the corresponding video stream based on the size of the video window to save bandwidth and computing resources. The default aspect ratio of the low-quality stream is the same as the high-quality stream. The system automatically allocates resolution, frame rate, and bitrate for the low-quality stream based on the current high-quality stream aspect ratio.
Note: If you call both this method and setRemoteDefaultVideoStreamType, the settings in this method take precedence.

Timing

You can call this method before or after joining a channel.

Parameters

uid
The user ID.
streamType
The video stream type. See VIDEO_STREAM_TYPE.

Return Values

  • 0: Success.
  • < 0: Failure.

setRemoteVideoStreamTypeEx

Sets the type of video stream to subscribe to.

virtual int setRemoteVideoStreamTypeEx(uid_t uid, VIDEO_STREAM_TYPE streamType, const RtcConnection& connection) = 0;
Depending on the sender's default behavior and the settings when calling setDualStreamModeEx, the receiver can call this method in the following scenarios:
  • By default, the SDK enables video low stream adaptive mode (AUTO_SIMULCAST_STREAM) on the sender, meaning only high stream is sent. In this case, only receivers with broadcaster role can call this method to request low stream. Once the sender receives the request, it automatically starts sending low stream. Then, all users in the channel can call this method to switch to low stream subscription mode.
  • If the sender calls setDualStreamMode and sets mode to DISABLE_SIMULCAST_STREAM (never send low stream), this method call is invalid.
  • If the sender calls setDualStreamMode and sets mode to ENABLE_SIMULCAST_STREAM (always send low stream), both broadcaster and audience roles on the receiver can call this method to switch to low stream subscription mode.
The SDK dynamically adjusts the video stream size based on the video window size to save bandwidth and computing resources. The default aspect ratio of the low stream is the same as the high stream. The system automatically allocates resolution, frame rate, and bitrate for the low stream based on the aspect ratio of the high stream.
Note: If the sender has called setDualStreamModeEx and set mode to DISABLE_SIMULCAST_STREAM, this method call is invalid. You should call setDualStreamModeEx again on the sender and adjust the settings.

Scenario

This method applies to multi-channel scenarios.

Parameters

uid
User ID.
streamType
Video stream type. See VIDEO_STREAM_TYPE.
connection
Connection information. See RtcConnection.

Return Values

  • 0: Success.
  • < 0: Failure.

setRemoteVideoSubscriptionOptions

Sets subscription options for remote video streams.

virtual int setRemoteVideoSubscriptionOptions(uid_t uid, const VideoSubscriptionOptions &options) = 0;
When the remote user enables dual-stream mode, you can call this method to configure the subscription options for the video stream sent by that user. The SDK's default behavior for subscribing to remote video streams depends on the type of video observer registered:
  • If IVideoFrameObserver is registered, the SDK subscribes to both raw and encoded data by default.
  • If IVideoEncodedFrameObserver is registered, the SDK subscribes to only encoded data by default.
  • If both observers are registered, the default behavior follows the last registered observer. For example, if IVideoFrameObserver is registered last, the SDK subscribes to both raw and encoded data.
If you want to change the default behavior or set different subscription options for different user IDs, you can use this method.

Parameters

uid
The user ID of the remote user.
options
The video subscription options. See VideoSubscriptionOptions.

Return Values

  • 0: Success.
  • < 0: Failure.

setRemoteVideoSubscriptionOptionsEx

Sets whether to subscribe to a remote user's video stream.

virtual int setRemoteVideoSubscriptionOptionsEx(uid_t uid, const VideoSubscriptionOptions& options, const RtcConnection& connection) = 0;

When a remote user enables dual-stream mode, you can call this method to set whether to subscribe to their video stream and specify the subscription options.

Scenario

This method applies to multi-channel scenarios.

Parameters

uid
The remote user ID.
options
Video subscription options. See VideoSubscriptionOptions.
connection
Connection information. See RtcConnection.

Return Values

  • 0: Success.
  • < 0: Failure.

setSubscribeAudioAllowlist

Sets the allowlist for audio stream subscription.

virtual int setSubscribeAudioAllowlist(uid_t* uidList, int uidNumber) = 0;
Note:
  • You can call this method before or after joining a channel.
  • The allowlist is not affected by muteRemoteAudioStream, muteAllRemoteAudioStreams, or the autoSubscribeAudio setting in ChannelMediaOptions.
  • Once the allowlist is set, it remains effective even if you leave and rejoin the channel.
  • If a user is included in both the allowlist and blocklist, only the blocklist takes effect.

Parameters

uidList
The list of user IDs whose audio streams you want to subscribe to. To remove a user from the allowlist, call setSubscribeAudioAllowlist again with a new list that only includes the user IDs you still want to subscribe to.
uidNumber
The number of user IDs in the list.

Return Values

  • 0: Success.
  • < 0: Failure.

setSubscribeAudioAllowlistEx

Sets the allowlist for audio stream subscription.

virtual int setSubscribeAudioAllowlistEx(uid_t* uidList, int uidNumber, const RtcConnection& connection) = 0;
Note:
  • You can call this method before or after joining a channel.
  • The allowlist is not affected by muteRemoteAudioStream, muteAllRemoteAudioStreams, or the autoSubscribeAudio setting in ChannelMediaOptions.
  • Once the subscription allowlist is set, it remains effective even if you leave and rejoin the current channel.
  • If a user is added to both the allowlist and blocklist, only the blocklist takes effect.

Scenario

This method applies to multi-channel scenarios.

Parameters

uidList
The list of user IDs you want to subscribe to. To subscribe to a user's audio stream, add the user's ID to this list. To remove a user from the allowlist, you need to call the setSubscribeAudioAllowlist method to update the user ID list; that is, you only need to include the user IDs of the users you want to subscribe to in the new list.
uidNumber
The number of users in the user ID list.
connection
Connection information. See RtcConnection.

Return Values

  • 0: The method call succeeds.
  • < 0: The method call fails.

setSubscribeAudioBlocklist

Sets the blocklist of users whose audio streams will not be subscribed to.

virtual int setSubscribeAudioBlocklist(uid_t* uidList, int uidNumber) = 0;
Note:
  • You can call this method before or after joining a channel.
  • The blocklist is not affected by muteRemoteAudioStream, muteAllRemoteAudioStreams, or the autoSubscribeAudio setting in ChannelMediaOptions.
  • Once the blocklist is set, it remains effective even if you leave and rejoin the channel.
  • If a user is included in both the allowlist and blocklist, only the blocklist takes effect.

Parameters

uidList
The list of user IDs whose audio streams you do not want to subscribe to. To remove a user from the blocklist, call setSubscribeAudioBlocklist again with a new list that only includes the user IDs you still want to block.
uidNumber
The number of user IDs in the list.

Return Values

  • 0: Success.
  • < 0: Failure.

setSubscribeAudioBlocklistEx

Sets the blocklist of users whose audio streams are not subscribed.

virtual int setSubscribeAudioBlocklistEx(uid_t* uidList, int uidNumber, const RtcConnection& connection) = 0;
Note:
  • You can call this method before or after joining a channel.
  • The blocklist is not affected by muteRemoteAudioStream, muteAllRemoteAudioStreams, or the autoSubscribeAudio setting in ChannelMediaOptions.
  • Once the subscription blocklist is set, it remains effective even if you leave and rejoin the current channel.
  • If a user is added to both the allowlist and blocklist, only the blocklist takes effect.

Scenario

This method applies to multi-channel scenarios.

Parameters

uidList
The list of user IDs whose audio streams you do not want to subscribe to. To remove a user from the blocklist, you need to call the setSubscribeAudioBlocklist method to update the user ID list.
uidNumber
The number of users in the user ID list.
connection
Connection information. See RtcConnection.

Return Values

  • 0: The method call succeeds.
  • < 0: The method call fails.

setSubscribeVideoAllowlist

Sets the allowlist for video stream subscription.

virtual int setSubscribeVideoAllowlist(uid_t* uidList, int uidNumber) = 0;
Note:
  • You can call this method before or after joining a channel.
  • The allowlist is not affected by muteRemoteVideoStream, muteAllRemoteVideoStreams, or the autoSubscribeAudio setting in ChannelMediaOptions.
  • Once the allowlist is set, it remains effective even if you leave and rejoin the channel.
  • If a user is included in both the allowlist and blocklist, only the blocklist takes effect.

Parameters

uidList
The list of user IDs whose video streams you want to subscribe to. To remove a user, call setSubscribeVideoAllowlist again with a new list that only includes the user IDs you still want to subscribe to.
uidNumber
The number of user IDs in the list.

Return Values

  • 0: Success.
  • < 0: Failure.

setSubscribeVideoAllowlistEx

Sets the allowlist for video stream subscription.

virtual int setSubscribeVideoAllowlistEx(uid_t* uidList, int uidNumber, const RtcConnection& connection) = 0;

You can call this method to specify the users whose video streams you want to subscribe to.

Note:
  • You can call this method before or after joining a channel.
  • The allowlist is not affected by the muteRemoteVideoStream, muteAllRemoteVideoStreams, or autoSubscribeAudio settings in ChannelMediaOptions.
  • Once the allowlist is set, it remains effective even if you leave and rejoin the channel.
  • If a user is added to both the allowlist and blocklist, only the blocklist takes effect.

Scenario

This method applies to multi-channel scenarios.

Parameters

uidList
The list of user IDs whose video streams you want to subscribe to. To subscribe to a user's video stream, add their user ID to this list. To remove a user from the allowlist, call setSubscribeVideoAllowlist to update the list and include only the user IDs you still want to subscribe to.
uidNumber
The number of user IDs in the list.
connection
Connection information. See RtcConnection.

Return Values

  • 0: Success.
  • < 0: Failure.

setSubscribeVideoBlocklist

Sets the blocklist for video stream subscription.

virtual int setSubscribeVideoBlocklist(uid_t* uidList, int uidNumber) = 0;
Note:
  • You can call this method before or after joining a channel.
  • The blocklist is not affected by muteRemoteVideoStream, muteAllRemoteVideoStreams, or the autoSubscribeAudio setting in ChannelMediaOptions.
  • Once the blocklist is set, it remains effective even if you leave and rejoin the channel.
  • If a user is included in both the allowlist and blocklist, only the blocklist takes effect.

Parameters

uidList
The list of user IDs whose video streams you do not want to subscribe to. To remove a user from the blocklist, call setSubscribeVideoBlocklist again with a new list that only includes the user IDs you still want to block.
uidNumber
The number of user IDs in the list.

Return Values

  • 0: Success.
  • < 0: Failure.

setSubscribeVideoBlocklistEx

Sets the list of user IDs whose video streams you do not want to subscribe to.

virtual int setSubscribeVideoBlocklistEx(uid_t* uidList, int uidNumber, const RtcConnection& connection) = 0;
Note:
  • You can call this method before or after joining a channel.
  • The blocklist is not affected by the muteRemoteVideoStream, muteAllRemoteVideoStreams, or autoSubscribeAudio settings in ChannelMediaOptions.
  • Once the blocklist is set, it remains effective even if you leave and rejoin the channel.
  • If a user is added to both the allowlist and blocklist, only the blocklist takes effect.

Scenario

This method applies to multi-channel scenarios.

Parameters

uidList
The list of user IDs whose video streams you do not want to subscribe to. To remove a user from the blocklist, call setSubscribeVideoBlocklist to update the list and include only the user IDs you still want to block.
uidNumber
The number of user IDs in the list.
connection
Connection information. See RtcConnection.

Return Values

  • 0: Success.
  • < 0: Failure.

onAudioPublishStateChanged

Callback triggered when the audio publishing state changes.

virtual void onAudioPublishStateChanged(const char* channel, STREAM_PUBLISH_STATE oldState, STREAM_PUBLISH_STATE newState, int elapseSinceLastState)

Parameters

channel
Channel name.
oldState
Previous audio publishing state. See STREAM_PUBLISH_STATE.
newState
Current audio publishing state. See STREAM_PUBLISH_STATE.
elapseSinceLastState
Time elapsed from the previous state to the current state (ms).

onAudioSubscribeStateChanged

Callback for audio subscription state changes.

virtual void onAudioSubscribeStateChanged(const char* channel, uid_t uid, STREAM_SUBSCRIBE_STATE oldState, STREAM_SUBSCRIBE_STATE newState, int elapseSinceLastState)

Parameters

channel
Channel name.
uid
Remote user ID.
oldState
Previous subscription state. See STREAM_SUBSCRIBE_STATE.
newState
Current subscription state. See STREAM_SUBSCRIBE_STATE.
elapseSinceLastState
Time elapsed from the previous state to the current state (ms).

onVideoSubscribeStateChanged

Callback for video subscription state changes.

virtual void onVideoSubscribeStateChanged(const char* channel, uid_t uid, STREAM_SUBSCRIBE_STATE oldState, STREAM_SUBSCRIBE_STATE newState, int elapseSinceLastState)

Parameters

channel
Channel name.
uid
Remote user ID.
oldState
Previous video subscription state. See STREAM_SUBSCRIBE_STATE.
newState
Current video subscription state. See STREAM_SUBSCRIBE_STATE.
elapseSinceLastState
Time elapsed from the previous state to the current state (ms).