addRemoteParticipantsAlreadyInRoom method

void addRemoteParticipantsAlreadyInRoom(
  1. Map<String, dynamic> result
)

Adds remote participants already in the room

Implementation

void addRemoteParticipantsAlreadyInRoom(Map<String, dynamic> result) {
  final List<dynamic> participants = result[JsonConstants.value];

  for (var participantJson in participants) {
    RemoteParticipant remoteParticipant =
        newRemoteParticipantAux(participantJson);

    try {
      List<dynamic> streams = participantJson['streams'];
      for (var stream in streams) {
        String streamId = stream['id'];
        remoteParticipant.isAudioActive = stream['audioActive'];
        remoteParticipant.isVideoActive = stream['videoActive'];
        subscribe(remoteParticipant, streamId);
      }
    } catch (e) {
      // Sometimes when entering a room, the other participants have no stream
      // Catching this to prevent stopping the iteration of participants
      _logger.info(
          'Error in addRemoteParticipantsAlreadyInRoom: ${e.toString()}');
    }
  }
}