joinChannelEx abstract method
- required String token,
- required RtcConnection connection,
- required ChannelMediaOptions options,
Joins a channel.
Call this method to join multiple channels simultaneously. If you want to join the same channel on different devices, make sure the user IDs used on each device are different. If you are already in a channel, you cannot join the same channel again with the same user ID. Before joining a channel, ensure that the App ID used to generate the Token is the same as the one used in the initialize method. Otherwise, joining the channel using the Token will fail.
tokenThe dynamic key generated on your server for authentication. See Token Authentication. (Recommended) If your project enables security mode (i.e., uses APP ID + Token for authentication), this parameter is required. If your project only enables debug mode (i.e., uses APP ID for authentication), you can join a channel without providing a Token. You will automatically leave the channel after 24 hours. If you need to join multiple channels at once or frequently switch between channels, Agora recommends using a wildcard Token to avoid requesting a new Token from your server for each new channel. See Wildcard Token.connectionConnection information. See RtcConnection.optionsChannel media options. See ChannelMediaOptions.
Returns When the method call succeeds, there is no return value; when it fails, the AgoraRtcException exception is thrown. You need to catch the exception and handle it accordingly. See Error Codes for details and resolution suggestions. < 0: Method call failed. See Error Codes for details and resolution suggestions. -2: Invalid parameters. For example, an invalid Token, uid is not an integer, or ChannelMediaOptions contains invalid values. Provide valid parameters and rejoin the channel. -3: RtcEngine initialization failed. Reinitialize the RtcEngine object. -7: RtcEngine not initialized. Initialize the RtcEngine object before calling this method. -8: Internal state error in RtcEngine. Possible cause: startEchoTest was called but stopEchoTest was not called before joining the channel. Call stopEchoTest before this method. -17: Join channel rejected. Possible cause: user is already in the channel. Use onConnectionStateChanged to check if the user is in the channel. Do not call this method again unless you receive connectionStateDisconnected (1). -102: Invalid channel name. Provide a valid channelId and rejoin the channel. -121: Invalid user ID. Provide a valid uid and rejoin the channel.
Implementation
Future<void> joinChannelEx(
{required String token,
required RtcConnection connection,
required ChannelMediaOptions options});