newRemoteParticipantAux method

RemoteParticipant newRemoteParticipantAux(
  1. Map<String, dynamic> participantJson
)

Implementation

RemoteParticipant newRemoteParticipantAux(
    Map<String, dynamic> participantJson) {
  final connectionId = participantJson[JsonConstants.id];
  String participantName = '';
  if (participantJson.containsKey(JsonConstants.metadata)) {
    final metadata = participantJson[JsonConstants.metadata];
    try {
      final json = jsonDecode(metadata);
      final clientData = json['clientData'];
      if (clientData != null) {
        participantName = clientData;
      }
    } catch (e) {
      participantName = metadata;
    }
  }
  final remoteParticipant =
      RemoteParticipant(connectionId, participantName, session);
  if (session.onAddRemoteParticipant != null) {
    session.onAddRemoteParticipant!(connectionId);
  }
  session.createRemotePeerConnection(remoteParticipant.connectionId!);
  return remoteParticipant;
}