joinChannelEx abstract method

Future<void> joinChannelEx({
  1. required String token,
  2. required RtcConnection connection,
  3. required ChannelMediaOptions options,
})

Joins a channel with the connection ID.

You can call this method multiple times to join more than one channel. If you are already in a channel, you cannot rejoin it with the same user ID. If you want to join the same channel from different devices, ensure that the user IDs are different for all devices. Ensure that the App ID you use to generate the token is the same as the App ID used when creating the RtcEngine instance. If you choose the Testing Mode (using an App ID for authentication) for your project and call this method to join a channel, you will automatically exit the channel after 24 hours.

  • token The token generated on your server for authentication. If you need to join different channels at the same time or switch between channels, Agora recommends using a wildcard token so that you don't need to apply for a new token every time joining a channel.
  • connection The connection information. See RtcConnection.
  • options The channel media options. See ChannelMediaOptions.

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 token is invalid, the uid parameter is not set to an integer, or the value of a member in ChannelMediaOptions is invalid. You need to pass in a valid parameter and join the channel again. -3: Failes to initialize the RtcEngine object. You need to reinitialize the RtcEngine object. -7: The RtcEngine object has not been initialized. You need to initialize the RtcEngine object before calling this method. -8: The internal state of the RtcEngine object is wrong. The typical cause is that you call this method to join the channel without calling startEchoTest to stop the test after calling stopEchoTest to start a call loop test. You need to call stopEchoTest before calling this method. -17: The request to join the channel is rejected. The typical cause is that the user is in the channel. Agora recommends that you use the onConnectionStateChanged callback to determine whether the user exists in the channel. Do not call this method to join the channel unless you receive the connectionStateDisconnected (1) state. -102: The channel name is invalid. You need to pass in a valid channelname in channelId to rejoin the channel. -121: The user ID is invalid. You need to pass in a valid user ID in uid to rejoin the channel.

Implementation

Future<void> joinChannelEx(
    {required String token,
    required RtcConnection connection,
    required ChannelMediaOptions options});