Publish and Subscribe

enableDualStreamMode [1/2]

Enables or disables dual-stream mode at the sender.

public abstract int enableDualStreamMode(boolean enabled)
Deprecated
Deprecated since v4.2.0. Use setDualStreamMode instead.
After enabling dual-stream mode, you can call the setRemoteVideoStreamType method to choose to receive either the high-quality or low-quality video stream on the subscriber's side. Dual-stream consists of the following two types of video streams:
  • High-quality stream: High bitrate, high resolution.
  • Low-quality stream: Low bitrate, low resolution.
Note:
  • This method applies to all types of video streams on the sender side, including but not limited to camera-captured video, screen sharing, and custom captured video streams.
  • If you need to enable dual-stream mode in a multi-channel scenario, you can call the enableDualStreamModeEx method.
  • You can call this method either 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 at the sender.

public abstract int enableDualStreamMode(boolean enabled, SimulcastStreamConfig streamConfig)
Deprecated
Deprecated since v4.2.0. Use setDualStreamMode instead.
You can call this method to enable or disable dual-stream mode at the sender. Dual-stream consists of one high-quality and one low-quality video stream:
  • High-quality stream: High bitrate, high resolution.
  • Low-quality stream: Low bitrate, low resolution.
After enabling dual-stream mode, you can call the setRemoteVideoStreamType method on the receiver side to choose to receive the high-quality or low-quality stream.
Note:
  • This method applies to all types of video streams on the sender side, including but not limited to camera-captured video, screen sharing, and custom captured video streams.
  • If you need to enable dual-stream mode in a multi-channel scenario, you can call the enableDualStreamModeEx method.
  • You can call this method either 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 of 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 dual-stream mode on the sending side.

public abstract int enableDualStreamModeEx(boolean enabled, SimulcastStreamConfig streamConfig, RtcConnection connection);
Deprecated
Deprecated since v4.2.0. Use setDualStreamModeEx instead.
You can call this method to enable or disable dual-stream mode on the sending side. Dual-stream consists of a high-quality video stream and a low-quality video stream:
  • High-quality stream: High bitrate, high resolution.
  • Low-quality stream: Low bitrate, low resolution.
After enabling dual-stream mode, you can call setRemoteVideoStreamType to choose whether to receive the high-quality or low-quality stream on the receiving side.
Note: This method applies to all types of video streams on the sending side, including but not limited to camera-captured video, screen sharing, and custom captured video streams.

Scenario

This method is applicable in multi-channel scenarios.

Parameters

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

Return Values

  • 0: Success.
  • < 0: Failure.

muteAllRemoteAudioStreams

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

public abstract int muteAllRemoteAudioStreams(boolean muted);

Call this method after joining a channel. The local user will stop or resume subscribing to all remote users' audio streams, including users who join later.

Note: If you call this method and then call enableAudio or disableAudio, the last call takes effect. By default, the SDK automatically subscribes to all remote users' audio streams when joining a channel. You can set autoSubscribeAudio to false in ChannelMediaOptions when calling joinChannel to cancel the subscription to all users' audio streams upon joining.

Timing

Call this method after joining a channel.

Parameters

muted
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.

Return Values

  • 0: Success.
  • < 0: Failure.

muteAllRemoteAudioStreamsEx

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

public abstract int muteAllRemoteAudioStreamsEx(boolean muted, RtcConnection connection);

Scenario

This method applies to multi-channel scenarios.

Timing

  • Call this method after joining a channel.
  • If you want to not subscribe to remote users' audio streams before joining a channel, set autoSubscribeAudio to false in ChannelMediaOptions when calling joinChannel.

Parameters

muted
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: Success.
  • < 0: Failure.

muteAllRemoteVideoStreams

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

public abstract int muteAllRemoteVideoStreams(boolean muted);

Call this method after joining a channel. After calling this method, the local user stops or resumes subscribing to all remote users' video streams, including those who join the channel later.

Note: If you call enableVideo or disableVideo after calling this method, the last call takes effect. By default, the SDK automatically subscribes to all remote users' video streams when you join a channel. You can set autoSubscribeVideo to false in ChannelMediaOptions when calling joinChannel to cancel subscribing to all users' video streams upon joining.

Timing

Call this method after joining a channel.

Parameters

muted
Whether to stop subscribing to all remote users' video streams.
Note:
  • true: Stop subscribing to all remote users' video streams.
  • false: (Default) Subscribe to all remote users' video streams.

Return Values

  • 0: Success.
  • < 0: Failure.

muteAllRemoteVideoStreamsEx

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

public abstract int muteAllRemoteVideoStreamsEx(boolean muted, RtcConnection connection);

After calling this method, you stop or resume subscribing to all remote users' video streams, including users who join the channel later.

Scenario

This method applies to multi-channel scenarios.

Parameters

muted
Whether to stop subscribing to all remote users' video streams:
  • true: Stop subscribing to all remote users' video streams.
  • false: Default is to subscribe to all remote users' video streams.
connection
Connection information. See RtcConnection.

Return Values

  • 0: Success.
  • < 0: Failure.

muteLocalAudioStream

Stops or resumes publishing the locally captured audio stream.

public abstract int muteLocalAudioStream(boolean muted);

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

Timing

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

Parameters

muted
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.

public abstract int muteLocalAudioStreamEx(boolean muted, RtcConnection connection);

After this method is successfully called, the remote client receives the onUserMuteAudio and onRemoteAudioStateChanged callbacks.

Note: This method does not affect ongoing audio recording, as it does not disable the audio capture device.

Scenario

This method applies to multi-channel scenarios.

Parameters

muted
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

Stops or resumes publishing the local video stream.

public abstract int muteLocalVideoStream(boolean muted);

This method controls whether to publish the local video stream. When you stop publishing the local video stream using this method, the video capturing device continues to work. Compared to disabling local video capture by setting enableLocalVideo to false, which also stops publishing the stream, this method responds faster.

Timing

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

Parameters

muted
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.

public abstract int muteLocalVideoStreamEx(boolean muted, RtcConnection connection);

After this method is successfully called, the remote client triggers the onUserMuteVideo callback.

Note: This method does not affect ongoing video recording, as it does not turn off the camera.

Scenario

This method applies to multi-channel scenarios.

Parameters

muted
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.

public abstract int muteRemoteAudioStream(int uid, boolean muted);

Timing

Call this method after joining a channel.

Parameters

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

Return Values

  • 0: Success.
  • < 0: Failure.

muteRemoteAudioStreamEx

Stops or resumes receiving the audio stream of a specified user.

public abstract int muteRemoteAudioStreamEx(int uid, boolean muted, RtcConnection connection);

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.
muted
Whether to stop receiving the specified user's audio stream:
  • true: Stop receiving the specified user's audio stream.
  • false: (Default) Resume receiving the specified user's audio stream.
connection
Connection information. See RtcConnection.

Return Values

  • 0: Success.
  • < 0: Failure.

muteRemoteVideoStream

Stops or resumes subscribing to the specified remote user's video stream.

public abstract int muteRemoteVideoStream(int uid, boolean muted);

Timing

Call this method after joining a channel.

Parameters

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

Return Values

  • 0: Success.
  • < 0: Failure.

muteRemoteVideoStreamEx

Stops or resumes receiving the video stream of a specified user.

public abstract int muteRemoteVideoStreamEx(int uid, boolean muted, RtcConnection connection);

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
Remote user ID.
muted
Whether to stop receiving the specified user's video stream:
  • true: Stop receiving the specified user's video stream.
  • false: (Default) Resume receiving the specified user's video stream.
connection
Connection information. See RtcConnection.

Return Values

  • 0: Success.
  • < 0: Failure.

setDualStreamMode [1/2]

Sets the video stream mode at the sender to control whether to send the low-quality stream.

public abstract int setDualStreamMode(Constants.SimulcastStreamMode mode);
You can call this method to set the video stream mode at the sender. By default, the SDK enables adaptive low-quality stream mode (AUTO_SIMULCAST_STREAM) at the sender, meaning the sender does not actively send the low-quality stream. Receivers with the host 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.
Note: Differences between this method and enableDualStreamMode:
  • Calling this method with mode set to DISABLE_SIMULCAST_STREAM is equivalent to calling enableDualStreamMode(false).
  • Calling this method with mode set 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 one called later takes precedence.

Parameters

mode
The video stream mode to send. See SimulcastStreamMode.

Return Values

  • 0: Success.
  • < 0: Failure.

setDualStreamMode [2/2]

Sets the video stream mode configuration with different quality layers at the sender.

public abstract int setDualStreamMode(Constants.SimulcastStreamMode mode, SimulcastStreamConfig streamConfig);
By default, the SDK enables adaptive low-quality stream mode (AUTO_SIMULCAST_STREAM) at the sender, meaning the sender does not actively send the low-quality stream. Receivers with the host 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.
Note: Differences between this method and enableDualStreamMode:
  • 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 one called later takes precedence.

Parameters

mode
The video stream mode to send. See SimulcastStreamMode.
streamConfig
Configuration of the low-quality stream. See SimulcastStreamConfig.
Note: This parameter is invalid when mode is set to DISABLE_SIMULCAST_STREAM.

Return Values

  • 0: Success.
  • < 0: Failure.

setDualStreamModeEx

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

public abstract int setDualStreamModeEx(Constants.SimulcastStreamMode mode, SimulcastStreamConfig streamConfig, RtcConnection connection);
By default, the SDK enables adaptive low-quality video stream mode (AUTO_SIMULCAST_STREAM) on the sender side. Receivers with the broadcaster role can request the low-quality video stream by calling setRemoteVideoStreamTypeEx, 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 video stream) or ENABLE_SIMULCAST_STREAM (always send low-quality video stream).
  • To restore the default behavior, call this method again and set mode to AUTO_SIMULCAST_STREAM.
Note: The difference between this method and enableDualStreamModeEx is as follows:
  • Setting mode to DISABLE_SIMULCAST_STREAM is equivalent to calling enableDualStreamModeEx(false).
  • Setting mode 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 later call takes precedence.

Scenario

This method is applicable in multi-channel scenarios.

Parameters

mode
Video stream sending mode. See SimulcastStreamMode.
streamConfig
Configuration for the low-quality video stream. See SimulcastStreamConfig.
Note: This parameter is not effective when mode is set to DISABLE_SIMULCAST_STREAM.
connection
Connection information. See RtcConnection.

Return Values

  • 0: Success.
  • < 0: Failure.

setRemoteDefaultVideoStreamType [1/2]

Sets the default video stream type to subscribe to.

public abstract int setRemoteDefaultVideoStreamType(Constants.VideoStreamType streamType);
Depending on the sender's default behavior and the settings when calling setDualStreamMode, the scenarios for calling this method on the receiver side are as follows:
  • By default, the SDK enables the adaptive low-stream mode (AUTO_SIMULCAST_STREAM) on the sender side, meaning only the high-quality video stream is sent. Only receivers with the broadcaster 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 subscribing to the low-quality stream.
  • If the sender calls setDualStreamMode and sets mode to DISABLE_SIMULCAST_STREAM (never send low-quality stream), then calling this method has no effect.
  • If the sender calls setDualStreamMode and sets mode to ENABLE_SIMULCAST_STREAM (always send low-quality stream), then both broadcaster and audience roles on the receiver side can call this method to switch to subscribing 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 that of the high-quality stream. The system automatically allocates the resolution, frame rate, and bitrate of the low-quality stream based on the current aspect ratio of the high-quality stream.
Note: If you call both this method and setRemoteVideoStreamType, the settings in setRemoteVideoStreamType take precedence.

Timing

Call this method before joining a channel. The SDK does not support changing the default subscribed video stream type after joining a channel.

Parameters

streamType
Video stream type. See VideoStreamType.

Return Values

  • 0: Success.
  • < 0: Failure.

setRemoteDefaultVideoStreamType [2/2]

Sets the default video stream type to subscribe to.

public abstract int setRemoteDefaultVideoStreamType(int streamType)
Deprecated
This method is deprecated. Use setRemoteDefaultVideoStreamType [1/2] instead.
Depending on the sender's default behavior and the settings when calling setDualStreamMode, the scenarios for calling this method on the receiver side are as follows:
  • By default, the SDK enables the adaptive low-stream mode (AUTO_SIMULCAST_STREAM) on the sender side, meaning only the high-quality video stream is sent. Only receivers with the broadcaster 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 subscribing to the low-quality stream.
  • If the sender calls setDualStreamMode and sets mode to DISABLE_SIMULCAST_STREAM (never send low-quality stream), then calling this method has no effect.
  • If the sender calls setDualStreamMode and sets mode to ENABLE_SIMULCAST_STREAM (always send low-quality stream), then both broadcaster and audience roles on the receiver side can call this method to switch to subscribing 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 that of the high-quality stream. The system automatically allocates the resolution, frame rate, and bitrate of the low-quality stream based on the current aspect ratio of the high-quality stream.
Note: If you call both this method and setRemoteVideoStreamType, the settings in setRemoteVideoStreamType take precedence.

Timing

Call this method before joining a channel. The SDK does not support changing the default subscribed video stream type after joining a channel.

Parameters

streamType
The default video stream type to subscribe to:
  • VIDEO_STREAM_HIGH (0): High-quality video stream, i.e., high resolution and high bitrate.
  • VIDEO_STREAM_LOW (1): Low-quality video stream, i.e., low resolution and low bitrate.

Return Values

  • 0: Success.
  • < 0: Failure.

setRemoteVideoStreamType [1/2]

Sets the type of video stream to subscribe to.

public abstract int setRemoteVideoStreamType(int uid, Constants.VideoStreamType streamType);
Depending on the sender's default behavior and the configuration of setDualStreamMode, the receiver can call this method in the following scenarios:
  • By default, the SDK enables adaptive low-stream mode (AUTO_SIMULCAST_STREAM) on the sender, meaning only the high-quality stream is sent. Only receivers with the broadcaster role can call this method to request the low-quality 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 subscribing to the low-quality stream.
  • If the sender calls setDualStreamMode and sets mode to DISABLE_SIMULCAST_STREAM (never send low-quality stream), this method call has no effect.
  • If the sender calls setDualStreamMode and sets mode to ENABLE_SIMULCAST_STREAM (always send low-quality stream), then both broadcasters and audience roles can call this method to switch to the low-quality stream.
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-quality stream is the same as the high-quality stream. The system automatically allocates resolution, frame rate, and bitrate of the low-quality stream based on the current high-quality stream's aspect ratio.
Note:
  • You can call this method before or after joining a channel.
  • If both this method and setRemoteDefaultVideoStreamType are called, this method takes precedence.

Parameters

uid
Remote user ID.
streamType
Video stream type. See VideoStreamType.

Return Values

  • 0: Success.
  • < 0: Failure.

setRemoteVideoStreamType [2/2]

Sets the type of video stream to subscribe to.

public abstract int setRemoteVideoStreamType(int uid, int streamType)
Deprecated
This method is deprecated. Use setRemoteVideoStreamType(int uid, Constants.VideoStreamType streamType) instead.
Depending on the sender's default behavior and the configuration of setDualStreamMode, the receiver can call this method in the following scenarios:
  • By default, the SDK enables adaptive low-stream mode (AUTO_SIMULCAST_STREAM) on the sender, meaning only the high-quality stream is sent. Only receivers with the broadcaster role can call this method to request the low-quality 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 subscribing to the low-quality stream.
  • If the sender calls setDualStreamMode and sets mode to DISABLE_SIMULCAST_STREAM (never send low-quality stream), this method call has no effect.
  • If the sender calls setDualStreamMode and sets mode to ENABLE_SIMULCAST_STREAM (always send low-quality stream), then both broadcasters and audience roles can call this method to switch to the low-quality stream.
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-quality stream is the same as the high-quality stream. The system automatically allocates resolution, frame rate, and bitrate of the low-quality stream based on the current high-quality stream's aspect ratio.
Note:
  • You can call this method before or after joining a channel.
  • If both this method and setRemoteDefaultVideoStreamType are called, this method takes precedence.

Parameters

uid
Remote user ID.
streamType
Video stream type:
  • 0: High-quality stream.
  • 1: Low-quality stream.

Return Values

  • 0: Success.
  • < 0: Failure.

setRemoteVideoStreamTypeEx [1/2]

Sets the type of video stream to subscribe to.

public abstract int setRemoteVideoStreamTypeEx(int uid, Constants.VideoStreamType streamType, RtcConnection connection);
Depending on the sender's default behavior and the settings when calling setDualStreamModeEx, the receiving end uses this method in the following scenarios:
  • By default, the SDK enables adaptive small video stream mode (AUTO_SIMULCAST_STREAM) on the sender, which sends only the high-quality video stream. In this case, only receivers with the Host role can call this method to request the small video stream. Once the sender receives the request, it automatically starts sending the small video stream. At this point, all users in the channel can call this method to switch to the small stream subscription mode.
  • If the sender calls setDualStreamMode and sets mode to DISABLE_SIMULCAST_STREAM (never send small video stream), calling this method has no effect.
  • If the sender calls setDualStreamMode and sets mode to ENABLE_SIMULCAST_STREAM (always send small video stream), both Host and Audience roles on the receiving end can call this method to switch to the small stream subscription mode.
The SDK dynamically adjusts the resolution of the video stream based on the size of the video window to save bandwidth and computing resources. The default aspect ratio of the small video stream is the same as the large video stream. The system automatically allocates the resolution, frame rate, and bitrate of the small video stream based on the current aspect ratio of the large video stream.
Note: If the sender has already called setDualStreamModeEx and set mode to DISABLE_SIMULCAST_STREAM, calling this method has no effect. You need to call setDualStreamModeEx again on the sender and adjust the settings.

Scenario

This method applies to multi-channel scenarios.

Parameters

uid
Remote user ID.
streamType
Video stream type. See VideoStreamType.
connection
Connection information. See RtcConnection.

Return Values

  • 0: Success.
  • < 0: Failure.

setRemoteVideoStreamTypeEx [2/2]

Sets the type of video stream to subscribe to.

public abstract int setRemoteVideoStreamTypeEx(int uid, int streamType, RtcConnection connection);
Deprecated
This method is deprecated. Use setRemoteVideoStreamTypeEx [1/2] instead.
Depending on the sender's default behavior and the settings when calling setDualStreamModeEx, the receiving end uses this method in the following scenarios:
  • By default, the SDK enables adaptive small video stream mode (AUTO_SIMULCAST_STREAM) on the sender, which sends only the high-quality video stream. Only receivers with the Host role can call this method to request the small video stream. Once the sender receives the request, it automatically starts sending the small video stream. At this point, all users in the channel can call this method to switch to the small stream subscription mode.
  • If the sender calls setDualStreamMode and sets mode to DISABLE_SIMULCAST_STREAM (never send small video stream), calling this method has no effect.
  • If the sender calls setDualStreamMode and sets mode to ENABLE_SIMULCAST_STREAM (always send small video stream), both Host and Audience roles on the receiving end can call this method to switch to the small stream subscription mode.
The SDK dynamically adjusts the resolution of the video stream based on the size of the video window to save bandwidth and computing resources. The default aspect ratio of the small video stream is the same as the large video stream. The system automatically allocates the resolution, frame rate, and bitrate of the small video stream based on the current aspect ratio of the large video stream.
Note: If the sender has already called setDualStreamModeEx and set mode to DISABLE_SIMULCAST_STREAM (never send small video stream), calling this method has no effect. You should call setDualStreamModeEx again on the sender and adjust the settings.

Scenario

This method applies to multi-channel scenarios.

Parameters

uid
Remote user ID.
streamType
Video stream type:
  • 0: High-quality video stream.
  • 1: Low-quality video stream.
connection
Connection information. See RtcConnection.

Return Values

  • 0: Success.
  • < 0: Failure.

setRemoteVideoSubscriptionOptions

Sets the options for subscribing to remote video streams.

public abstract int setRemoteVideoSubscriptionOptions(int uid, VideoSubscriptionOptions options);
You can call this method to set the subscription options for the video stream sent by a remote user. This is applicable when the remote user enables dual-stream mode. The SDK's default subscription behavior depends on the type of registered video observer:
  • If IVideoFrameObserver is registered, the SDK subscribes to both raw and encoded data by default.
  • If IVideoEncodedFrameObserver is registered, the SDK subscribes only to 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 by default.
If you want to change the default behavior or set different subscription options for different user IDs, you can call this method.

Parameters

uid
User ID of the remote user.
options
Video subscription options. See VideoSubscriptionOptions.

Return Values

  • 0: Success.
  • < 0: Failure.

setRemoteVideoSubscriptionOptionsEx

Sets the options for subscribing to remote video streams.

public abstract int setRemoteVideoSubscriptionOptionsEx(int uid, VideoSubscriptionOptions options, RtcConnection rtcConnection);

This method applies to multi-channel scenarios. When the remote user enables dual-stream mode, you can call this method to set the options for subscribing to the video stream sent by the remote user.

Scenario

This method applies to multi-channel scenarios.

Parameters

uid
Remote user ID.
options
Video subscription options. See VideoSubscriptionOptions.
rtcConnection
Connection information. See RtcConnection.

Return Values

  • 0: Success.
  • < 0: Failure.

setSubscribeAudioAllowlist

Sets the audio stream subscription allowlist.

public abstract int setSubscribeAudioAllowlist(int[] uidList);
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 added to both the allowlist and blocklist, only the blocklist takes effect.

Parameters

uidList
List of user IDs whose audio streams you want to subscribe to. When you call this method, only audio streams from users in this list are subscribed to. If you want 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.

Return Values

  • 0: Success.
  • < 0: Failure.

setSubscribeAudioAllowlistEx

Sets the allowlist for audio stream subscription.

public abstract int setSubscribeAudioAllowlistEx(int[] uidList, RtcConnection connection);
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 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 want to subscribe to. To remove a user from the allowlist, call the setSubscribeAudioAllowlist method to update the list; that is, only include the user IDs you want to subscribe to in the new list.
connection
Connection information. See RtcConnection.

Return Values

  • 0: Success.
  • < 0: Failure.

setSubscribeAudioBlocklist

Sets the audio stream subscription blocklist.

public abstract int setSubscribeAudioBlocklist(int[] uidList);
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 added to both the allowlist and blocklist, only the blocklist takes effect.

Parameters

uidList
List of user IDs whose audio streams you do not want to subscribe to.
  • If you want to remove a user from the blocklist, call setSubscribeAudioBlocklist again with an updated list that only includes the user IDs you still want to block.

Return Values

  • 0: Success.
  • < 0: Failure.

setSubscribeAudioBlocklistEx

Sets the blocklist for audio stream subscription.

public abstract int setSubscribeAudioBlocklistEx(int[] uidList, RtcConnection connection);

You can call this method to specify the users whose audio streams you do not want to subscribe to.

Note:
  • You can call this method before or after joining a channel.
  • The blocklist setting 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 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.
Note:
  • To stop subscribing to a user's audio stream, add the user's ID to this list.
  • To remove a user from the blocklist, call the setSubscribeAudioBlocklist method to update the list. That is, only include the user IDs you do not want to subscribe to in the new list.
connection
Connection information. See RtcConnection.

Return Values

  • 0: Success.
  • < 0: Failure.

setSubscribeVideoAllowlist

Sets the video stream subscription allowlist.

public abstract int setSubscribeVideoAllowlist(int[] uidList);
Note:
  • You can call this method before or after joining a channel.
  • The allowlist is not affected by muteRemoteVideoStream, muteAllRemoteVideoStreams, or the autoSubscribeVideo setting 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.

Parameters

uidList
List of user IDs whose video streams you want to subscribe to.
  • If you want to subscribe to a user's video stream, add their user ID to this list.
  • If you want to remove a user from the allowlist, call setSubscribeVideoAllowlist again with a new list that only includes the user IDs you still want to subscribe to.

Return Values

  • 0: Success.
  • < 0: Failure.

setSubscribeVideoAllowlistEx

Sets the allowlist for video stream subscription.

public abstract int setSubscribeVideoAllowlistEx(int[] uidList, RtcConnection connection);
Note:
  • You can call this method before or after joining a channel.
  • The allowlist is not affected by muteRemoteVideoStream, muteAllRemoteVideoStreams, or the autoSubscribeVideo setting 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 the user's ID to this list.
  • To remove a user from the allowlist, call the setSubscribeVideoAllowlist method to update the list; that is, only include the user IDs you want to subscribe to in the new list.
connection
Connection information. See RtcConnection.

Return Values

  • 0: Success.
  • < 0: Failure.

setSubscribeVideoBlocklist

Sets the video stream subscription blocklist.

public abstract int setSubscribeVideoBlocklist(int[] uidList);
Note:
  • You can call this method before or after joining a channel.
  • The blocklist is not affected by muteRemoteVideoStream, muteAllRemoteVideoStreams, or the autoSubscribeVideo setting 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.

Parameters

uidList
List of user IDs whose video streams you do not want to subscribe to.
  • If you want to block a user's video stream, add their user ID to this list.
  • If you want to remove a user from the blocklist, call setSubscribeVideoBlocklist again with an updated list that only includes the user IDs you still want to block.

Return Values

  • 0: Success.
  • < 0: Failure.

setSubscribeVideoBlocklistEx

Sets the blocklist for video stream subscription.

public abstract int setSubscribeVideoBlocklistEx(int[] uidList, RtcConnection connection);
Note:
  • You can call this method before or after joining a channel.
  • The blocklist setting is not affected by muteRemoteVideoStream, muteAllRemoteVideoStreams, or the autoSubscribeVideo setting 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 remote user IDs whose video streams you do not want to subscribe to. To unsubscribe from a user's video stream, add the user's ID to this list. To remove a user from the blocklist, call the setSubscribeVideoBlocklist method to update the list, including only the user IDs you do not want to subscribe to.
connection
Connection information. See RtcConnection.

Return Values

  • 0: Success.
  • < 0: Failure.

onAudioPublishStateChanged

Callback for audio publish state change.

public void onAudioPublishStateChanged(String channel, int oldState, int newState, int elapseSinceLastState)

Trigger Timing

This callback is triggered when the audio publish state changes.

Parameters

channel
Channel name.
oldState
Previous audio publish state:
  • PUB_STATE_IDLE (0): Initial publish state after joining the channel.
  • PUB_STATE_NO_PUBLISHED (1): Failed to publish the local stream.
  • PUB_STATE_PUBLISHING (2): Publishing the local stream.
  • PUB_STATE_PUBLISHED (3): Successfully published the local stream.
newState
Current audio publish state:
  • PUB_STATE_IDLE (0): Initial publish state after joining the channel.
  • PUB_STATE_NO_PUBLISHED (1): Failed to publish the local stream.
  • PUB_STATE_PUBLISHING (2): Publishing the local stream.
  • PUB_STATE_PUBLISHED (3): Successfully published the local stream.
elapseSinceLastState
Time elapsed (ms) from the previous state to the current state.

onAudioSubscribeStateChanged

Callback for audio subscription state change.

public void onAudioSubscribeStateChanged(String channel, int uid, int oldState, int newState, int elapseSinceLastState)

This callback is triggered when the local user's subscription state to a remote audio stream changes.

Trigger Timing

This callback is triggered when the local user's subscription state to a remote audio stream changes.

Parameters

channel
Channel name.
uid
Remote user ID.
oldState
Previous subscription state:
  • SUB_STATE_IDLE (0): Initial subscription state after joining the channel.
  • SUB_STATE_NO_SUBSCRIBED (1): Failed to subscribe to remote audio stream. Possible reasons include:
    • Remote user:
      • Called muteLocalAudioStream(true) to stop sending local audio stream.
      • Called disableAudio to disable the local audio module.
      • Called enableLocalAudio(false) to disable local audio capture.
      • Role is audience.
    • Local user:
  • SUB_STATE_SUBSCRIBING (2): Subscribing.
  • SUB_STATE_SUBSCRIBED (3): Successfully received remote audio stream.
newState
Current subscription state:
  • SUB_STATE_IDLE (0): Initial subscription state after joining the channel.
  • SUB_STATE_NO_SUBSCRIBED (1): Failed to subscribe to remote audio stream. Possible reasons include:
    • Remote user:
      • Called muteLocalAudioStream(true) to stop sending local audio stream.
      • Called disableAudio to disable the local audio module.
      • Called enableLocalAudio(false) to disable local audio capture.
      • Role is audience.
    • Local user:
  • SUB_STATE_SUBSCRIBING (2): Subscribing.
  • SUB_STATE_SUBSCRIBED (3): Successfully received remote audio stream.
elapseSinceLastState
Time elapsed from the previous state to the current state, in milliseconds.

onVideoSubscribeStateChanged

Callback for video subscription state change.

public void onVideoSubscribeStateChanged(String channel, int uid, int oldState, int newState, int elapseSinceLastState)

Trigger Timing

This callback is triggered when the local user's subscription state to a remote video stream changes.

Parameters

channel
Channel name.
uid
Remote user ID.
oldState
Previous subscription state:
  • SUB_STATE_IDLE (0): Initial subscription state after joining the channel.
  • SUB_STATE_NO_SUBSCRIBED (1): Failed to subscribe to remote stream. Possible reasons include:
    • Remote user:
      • Called muteLocalVideoStream(true) to stop sending local video stream.
      • Called disableVideo to disable the local video module.
      • Called enableLocalVideo(false) to disable local video capture.
      • Role is audience.
    • Local user:
  • SUB_STATE_SUBSCRIBING (2): Subscribing.
  • SUB_STATE_SUBSCRIBED (3): Successfully received remote stream.
newState
Current subscription state:
  • SUB_STATE_IDLE (0): Initial subscription state after joining the channel.
  • SUB_STATE_NO_SUBSCRIBED (1): Failed to subscribe to remote stream. Possible reasons include:
    • Remote user:
      • Called muteLocalVideoStream(true) to stop sending local video stream.
      • Called disableVideo to disable the local video module.
      • Called enableLocalVideo(false) to disable local video capture.
      • Role is audience.
    • Local user:
  • SUB_STATE_SUBSCRIBING (2): Subscribing.
  • SUB_STATE_SUBSCRIBED (3): Successfully received remote stream.
elapseSinceLastState
Time elapsed from the previous state to the current state, in milliseconds.