enterRoom method Null safety
- TRTCParams param,
- int scene
Enter room
After calling this API, you will receive the onEnterRoom(result) callback from TRTCCloudListener:
If room entry succeeded, result will be a positive number (result > 0), indicating the time in milliseconds (ms) used for entering the room.
If room entry failed, result will be a negative number (result < 0), indicating the error code for room entry failure.
Parameters:
param Room entry parameters. For more information, please see the definition of the TRTCParams parameter in trtc_cloud_def.dart
scene Application scenario. Currently, video call (VideoCall), live streaming (Live), audio call (AudioCall), and voice chat room (VoiceChatRoom) are supported.
Note:
- 
If sceneis selected asTRTC_APP_SCENE_LIVEorTRTC_APP_SCENE_VOICE_CHATROOM, you must use therolefield inTRTCParamsto specify the role of the current user.
- 
No matter whether room entry is successful, enterRoommust be used together withexitRoom. IfenterRoomis called again beforeexitRoomis called, an unexpected error will occur.
Implementation
Future<void> enterRoom(TRTCParams param, int scene) {
  if (Platform.isAndroid || Platform.isWindows) {
    return _channel.invokeMethod('enterRoom', {
      "sdkAppId": param.sdkAppId,
      "userId": param.userId,
      "userSig": param.userSig,
      "roomId": param.roomId.toString(),
      "strRoomId": param.strRoomId,
      "role": param.role,
      "streamId": param.streamId,
      "userDefineRecordId": param.userDefineRecordId,
      "privateMapKey": param.privateMapKey,
      "businessInfo": param.businessInfo,
      "scene": scene,
    });
  } else {
    return _channel.invokeMethod('enterRoom', {
      "param": jsonEncode(param),
      "scene": scene,
    });
  }
}