preloadChannelWithUserAccount abstract method

Future<void> preloadChannelWithUserAccount({
  1. required String token,
  2. required String channelId,
  3. required String userAccount,
})

Preloads a channel with token, channelId, and userAccount.

When audience members need to switch between different channels frequently, calling the method can help shortening the time of joining a channel, thus reducing the time it takes for audience members to hear and see the host. If you join a preloaded channel, leave it and want to rejoin the same channel, you do not need to call this method unless the token for preloading the channel expires. Failing to preload a channel does not mean that you can't join a channel, nor will it increase the time of joining a channel.

  • token The token generated on your server for authentication. When the token for preloading channels expires, you can update the token based on the number of channels you preload. When preloading one channel, calling this method to pass in the new token. When preloading more than one channels: If you use a wildcard token for all preloaded channels, call updatePreloadChannelToken to update the token. When generating a wildcard token, ensure the user ID is not set as 0. If you use different tokens to preload different channels, call this method to pass in your user ID, channel name and the new token.
  • channelId The channel name that you want to preload. 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 channel ID enter the same channel for audio and video interaction. The string length must be less than 64 bytes. Supported characters (89 characters in total): All lowercase English letters: a to z. All uppercase English letters: A to Z. All numeric characters: 0 to 9. "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "", "", "^", "_", "{", "}", "|", "~", ","
  • userAccount The user account. This parameter is used to identify the user in the channel for real-time audio and video engagement. You need to set and manage user accounts yourself and ensure that each user account in the same channel is unique. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as NULL. Supported characters are as follows(89 in total): The 26 lowercase English letters: a to z. The 26 uppercase English letters: A to Z. All numeric characters: 0 to 9. Space "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "", "", "^", "_", "{", "}", "|", "~", ","

Returns When the method call succeeds, there is no return value; when fails, the AgoraRtcException exception is thrown. You need to catch the exception and handle it accordingly. < 0: Failure. -2: The parameter is invalid. For example, the User Account is empty. You need to pass in a valid parameter and join the channel again. -7: The RtcEngine object has not been initialized. You need to initialize the RtcEngine object before calling this method. -102: The channel name is invalid. You need to pass in a valid channel name and join the channel again.

Implementation

Future<void> preloadChannelWithUserAccount(
    {required String token,
    required String channelId,
    required String userAccount});