joinChannel method

  1. @override
Future<void> joinChannel(
  1. String token,
  2. String optionalUid,
  3. ChannelMediaOptions options
)

Joins the channel with a user ID.

Note

  • If you are already in a channel, you cannot rejoin it with the same uid.
  • We recommend using different UIDs for different channels.
  • If you want to join the same channel from different devices, ensure that the UIDs in all devices are different.
  • Ensure that the app ID you use to generate the token is the same with the app ID used when creating the RtcEngine instance.

Parameter token token

Parameter optionalUid The user ID. This parameter must be unique. If uid is not assigned (or set as 0), the SDK assigns a uid and reports it in the onJoinChannelSuccess callback. The app must maintain this user ID.

Parameter options The channel media options. See ChannelMediaOptions.

Implementation

@override
Future<void> joinChannel(String token, String optionalUid,
    ChannelMediaOptions options) {
  return _invokeMethod('joinChannel', {
    'token': token,
    'optionalUid': optionalUid,
    'options': options.toJson()
  });
}