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
setDualStreamModeinstead.
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.
- 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
setDualStreamModeinstead.
- High-quality stream: High bitrate, high resolution.
- Low-quality stream: Low bitrate, low resolution.
setRemoteVideoStreamType method on the receiver side to choose to receive the high-quality or low-quality stream.- 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
modeis set toDISABLE_SIMULCAST_STREAM,streamConfighas 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.
- High-quality stream: High bitrate, high resolution.
- Low-quality stream: Low bitrate, low resolution.
setRemoteVideoStreamType to choose whether to receive the high-quality or low-quality stream on the receiving side.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
modeis set toDISABLE_SIMULCAST_STREAM,streamConfighas 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.
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
autoSubscribeAudioto false in ChannelMediaOptions when callingjoinChannel.
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.
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.
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.
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);
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
modetoDISABLE_SIMULCAST_STREAM(never send low-quality stream) orENABLE_SIMULCAST_STREAM(always send low-quality stream). - To restore the default behavior, call this method again and set
modetoAUTO_SIMULCAST_STREAM.
enableDualStreamMode:
- Calling this method with
modeset toDISABLE_SIMULCAST_STREAMis equivalent to callingenableDualStreamMode(false). - Calling this method with
modeset toENABLE_SIMULCAST_STREAMis equivalent to callingenableDualStreamMode(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);
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
modetoDISABLE_SIMULCAST_STREAM(never send low-quality stream) orENABLE_SIMULCAST_STREAM(always send low-quality stream). - To restore the default behavior, call this method again and set
modetoAUTO_SIMULCAST_STREAM.
enableDualStreamMode:
- Calling this method with
modeset toDISABLE_SIMULCAST_STREAMis equivalent to callingenableDualStreamModewithenabledset to false. - Calling this method with
modeset toENABLE_SIMULCAST_STREAMis equivalent to callingenableDualStreamModewithenabledset 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
modeis set toDISABLE_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);
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
modetoDISABLE_SIMULCAST_STREAM(never send low-quality video stream) orENABLE_SIMULCAST_STREAM(always send low-quality video stream). - To restore the default behavior, call this method again and set
modetoAUTO_SIMULCAST_STREAM.
- Setting
modetoDISABLE_SIMULCAST_STREAMis equivalent to callingenableDualStreamModeEx(false). - Setting
modetoENABLE_SIMULCAST_STREAMis equivalent to callingenableDualStreamModeEx(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
modeis set toDISABLE_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);
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
setDualStreamModeand setsmodetoDISABLE_SIMULCAST_STREAM(never send low-quality stream), then calling this method has no effect. - If the sender calls
setDualStreamModeand setsmodetoENABLE_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.
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.
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
setDualStreamModeand setsmodetoDISABLE_SIMULCAST_STREAM(never send low-quality stream), then calling this method has no effect. - If the sender calls
setDualStreamModeand setsmodetoENABLE_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.
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);
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
setDualStreamModeand setsmodetoDISABLE_SIMULCAST_STREAM(never send low-quality stream), this method call has no effect. - If the sender calls
setDualStreamModeand setsmodetoENABLE_SIMULCAST_STREAM(always send low-quality stream), then both broadcasters and audience roles can call this method to switch to the low-quality stream.
- You can call this method before or after joining a channel.
- If both this method and
setRemoteDefaultVideoStreamTypeare 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.
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
setDualStreamModeand setsmodetoDISABLE_SIMULCAST_STREAM(never send low-quality stream), this method call has no effect. - If the sender calls
setDualStreamModeand setsmodetoENABLE_SIMULCAST_STREAM(always send low-quality stream), then both broadcasters and audience roles can call this method to switch to the low-quality stream.
- You can call this method before or after joining a channel.
- If both this method and
setRemoteDefaultVideoStreamTypeare 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);
- 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
setDualStreamModeand setsmodetoDISABLE_SIMULCAST_STREAM(never send small video stream), calling this method has no effect. - If the sender calls
setDualStreamModeand setsmodetoENABLE_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.
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.
- 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
setDualStreamModeand setsmodetoDISABLE_SIMULCAST_STREAM(never send small video stream), calling this method has no effect. - If the sender calls
setDualStreamModeand setsmodetoENABLE_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.
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);
- 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.
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);
- You can call this method before or after joining a channel.
- The allowlist is not affected by muteRemoteAudioStream, muteAllRemoteAudioStreams, or the
autoSubscribeAudiosetting 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);
- You can call this method before or after joining a channel.
- The allowlist is not affected by muteRemoteAudioStream, muteAllRemoteAudioStreams, or the
autoSubscribeAudiosetting 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);
- You can call this method before or after joining a channel.
- The blocklist is not affected by muteRemoteAudioStream, muteAllRemoteAudioStreams, or the
autoSubscribeAudiosetting 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.
- You can call this method before or after joining a channel.
- The blocklist setting is not affected by muteRemoteAudioStream, muteAllRemoteAudioStreams, or the
autoSubscribeAudiosetting 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);
- You can call this method before or after joining a channel.
- The allowlist is not affected by muteRemoteVideoStream, muteAllRemoteVideoStreams, or the
autoSubscribeVideosetting 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);
- You can call this method before or after joining a channel.
- The allowlist is not affected by muteRemoteVideoStream, muteAllRemoteVideoStreams, or the
autoSubscribeVideosetting 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);
- You can call this method before or after joining a channel.
- The blocklist is not affected by muteRemoteVideoStream, muteAllRemoteVideoStreams, or the
autoSubscribeVideosetting 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);
- You can call this method before or after joining a channel.
- The blocklist setting is not affected by muteRemoteVideoStream, muteAllRemoteVideoStreams, or the
autoSubscribeVideosetting 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.
- Called
- Local user:
- Set
autoSubscribeAudioto false in ChannelMediaOptions when callingjoinChannelor updateChannelMediaOptions, meaning not to automatically subscribe to any audio stream. - Called muteRemoteAudioStream or muteAllRemoteAudioStreams with
mutedset to true, meaning to stop receiving remote audio streams.
- Set
- Remote 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.
- Called
- Local user:
- Set
autoSubscribeAudioto false in ChannelMediaOptions when callingjoinChannelor updateChannelMediaOptions, meaning not to automatically subscribe to any audio stream. - Called muteRemoteAudioStream or muteAllRemoteAudioStreams with
mutedset to true, meaning to stop receiving remote audio streams.
- Set
- Remote 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.
- Called
- Local user:
- Set
autoSubscribeVideoto false in ChannelMediaOptions when callingjoinChannelor updateChannelMediaOptions, meaning not to automatically subscribe to any video stream. - Called muteRemoteVideoStream or muteAllRemoteVideoStreams with
mutedset to true, meaning to stop receiving remote video streams.
- Set
- Remote 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.
- Called
- Local user:
- Set
autoSubscribeVideoto false in ChannelMediaOptions when callingjoinChannelor updateChannelMediaOptions, meaning not to automatically subscribe to any video stream. - Called muteRemoteVideoStream or muteAllRemoteVideoStreams with
mutedset to true, meaning to stop receiving remote video streams.
- Set
- Remote 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.