unfocusPanelists function

Future<void> unfocusPanelists(
  1. UnfocusPanelistsOptions options
)

Disables panelist focus mode. All participants will be shown on the grid again.

Example:

await unfocusPanelists(UnfocusPanelistsOptions(
  socket: socket,
  roomName: "room123",
  member: "currentUser",
  islevel: "2",
  showAlert: (alert) => print(alert.message),
));

Implementation

Future<void> unfocusPanelists(UnfocusPanelistsOptions options) async {
  // Only hosts can unfocus panelists
  if (options.islevel != "2") {
    options.showAlert?.call(
      message: "Only the host can unfocus panelists",
      type: "danger",
      duration: 3000,
    );
    return;
  }

  options.socket.emitWithAck("focusPanelists", {
    'roomName': options.roomName,
    'focusEnabled': false,
    'muteOthersMic': false,
    'muteOthersCamera': false,
  }, ack: (response) {
    if (response == null || response['success'] != true) {
      final reason = response?['reason'] ?? 'Unknown error';
      debugPrint('unfocusPanelists failed: $reason');
      options.showAlert?.call(
        message: reason,
        type: "danger",
        duration: 3000,
      );
    } else {
      options.showAlert?.call(
        message: "Panelist focus disabled",
        type: "info",
        duration: 3000,
      );
    }
  });
}