switchChannel abstract method

Future<void> switchChannel(
  1. String? token,
  2. String channelName, [
  3. ChannelMediaOptions? options
])

Switches to a different channel, and configures whether to automatically subscribe to audio or video streams in the target channel. This method allows the audience of a LIVE_BROADCASTING channel to switch to a different channel. After the user successfully switches to another channel, the leaveChannel and joinChannelSuccess callbacks are triggered to indicate that the user has left the original channel and joined a new one. Once the user switches to another channel, the user subscribes to the audio and video streams of all the other users in the channel by default, giving rise to usage and billing calculation. If you do not want to subscribe to a specified stream or all remote streams, call the mute methods accordingly.

Param token The token generated at your server. In scenarios with low security requirements, token is optional and can be set as null. In scenarios with high security requirements, set the value to the token generated from your server. If you enable the App Certificate, you must use a token to join the channel. Ensure that the App ID used for creating the token is the same App ID used by the createWithContext method for initializing the RTC engine.

Param channelName The name of the channel. This parameter signifies the channel in which users engage in real-time audio and video interaction. Under the premise of the same App ID, users who fill in the same channelId enter the same channel for audio and video interaction. The string length must be less than 64 bytes. Supported characters: All lowercase English letters: a to z. All uppercase English letters: A to Z. All numeric characters: 0 to 9. Space "!"、"#"、"$"、"%"、"&"、"("、")"、"+"、"-"、":"、";"、"<"、"="、"."、">"、"?"、"@"、""、""、"^"、"_"、"{"、"}"、"|"、"~"、","

Param options The channel media options. See ChannelMediaOptions.

Implementation

Future<void> switchChannel(String? token, String channelName,
    [ChannelMediaOptions? options]);