NEInRoomVideoControl.fromJson constructor

NEInRoomVideoControl.fromJson(
  1. Map? json
)

Implementation

factory NEInRoomVideoControl.fromJson(Map<dynamic, dynamic>? json) {
  bool allowSelfOn = true;
  bool enabled = false;
  NERoomAttendeeOffType attendeeOff = NERoomAttendeeOffType.none;
  if (json != null) {
    final value = json['value'] as String;
    if (value.startsWith(RegExp('${VideoControlProperty.offAllowSelfOn}'))) {
      allowSelfOn = true;
      enabled = true;
      attendeeOff = NERoomAttendeeOffType.offAllowSelfOn;
    } else if (value
        .startsWith(RegExp('${VideoControlProperty.offNotAllowSelfOn}'))) {
      allowSelfOn = false;
      enabled = true;
      attendeeOff = NERoomAttendeeOffType.offNotAllowSelfOn;
    }
  }
  return NEInRoomVideoControl(
      attendeeOff: attendeeOff, enabled: enabled, allowSelfOn: allowSelfOn);
}