MediaSFU ReactJS
    Preparing search index...

    Variable EventSettingsModalConst

    EventSettingsModal: React.FC<EventSettingsModalOptions> = ...

    EventSettingsModal - Host controls for participant permissions and meeting settings

    A comprehensive modal for meeting hosts to configure participant permissions for audio, video, screen sharing, and chat. Provides granular control with allow/disallow/approval options, enabling hosts to manage meeting security and participant interactions effectively.

    Features:

    • Audio permission control (allow, disallow, approval required)
    • Video permission control (allow, disallow, approval required)
    • Screen share permission control (allow, disallow, approval required)
    • Chat permission control (allow, disallow)
    • Real-time settings synchronization via socket
    • Customizable permission labels and options
    • Extensive HTML attributes customization
    • Custom render hooks for sections
    • Responsive positioning
    • Settings validation

    Configuration options

    Modal visibility state

    Callback when modal is closed

    Settings modification handler

    Modal screen position

    Modal background color

    Current audio permission ('allow', 'disallow', 'approval')

    Current video permission ('allow', 'disallow', 'approval')

    Current screenshare permission ('allow', 'disallow', 'approval')

    Current chat permission ('allow', 'disallow')

    Update audio permission state

    Update video permission state

    Update screenshare permission state

    Update chat permission state

    Update modal visibility state

    Meeting/room identifier

    Socket.io client instance

    Alert display function

    Custom modal title

    HTML attributes for overlay

    HTML attributes for content container

    HTML attributes for header

    HTML attributes for title

    HTML attributes for close button

    Custom close icon

    HTML attributes for divider

    HTML attributes for body

    HTML attributes for setting fields

    HTML attributes for audio field

    HTML attributes for video field

    HTML attributes for screenshare field

    HTML attributes for chat field

    HTML attributes for labels

    HTML attributes for audio label

    HTML attributes for video label

    HTML attributes for screenshare label

    HTML attributes for chat label

    HTML attributes for selects

    HTML attributes for audio select

    HTML attributes for video select

    HTML attributes for screenshare select

    HTML attributes for chat select

    HTML attributes for separator

    HTML attributes for footer

    HTML attributes for save button

    Custom save button label

    Custom audio label

    Custom video label

    Custom screenshare label

    Custom chat label

    Custom disallow option label

    Custom allow option label

    Custom approval option label

    Custom chat disallow label

    Custom chat allow label

    Custom audio permission options

    Custom video permission options

    Custom screenshare permission options

    Custom chat permission options

    Custom header renderer

    Custom body renderer

    Custom settings renderer

    Custom section renderer

    Custom separator renderer

    Rendered event settings modal

    // Basic event settings for host

    import React, { useState } from 'react';
    import { EventSettingsModal } from 'mediasfu-reactjs';

    function HostSettings({ socket, roomName, showAlert }) {
    const [isVisible, setIsVisible] = useState(false);
    const [audioSetting, setAudioSetting] = useState('allow');
    const [videoSetting, setVideoSetting] = useState('approval');
    const [screenshareSetting, setScreenshareSetting] = useState('approval');
    const [chatSetting, setChatSetting] = useState('allow');

    return (
    <>
    <button onClick={() => setIsVisible(true)}>
    Event Settings
    </button>
    <EventSettingsModal
    isEventSettingsModalVisible={isVisible}
    onEventSettingsClose={() => setIsVisible(false)}
    audioSetting={audioSetting}
    videoSetting={videoSetting}
    screenshareSetting={screenshareSetting}
    chatSetting={chatSetting}
    updateAudioSetting={setAudioSetting}
    updateVideoSetting={setVideoSetting}
    updateScreenshareSetting={setScreenshareSetting}
    updateChatSetting={setChatSetting}
    updateIsSettingsModalVisible={setIsVisible}
    roomName={roomName}
    socket={socket}
    showAlert={showAlert}
    position="topRight"
    backgroundColor="#0f172a"
    />
    </>
    );
    }

    // Custom styled with permission indicators

    import { EventSettingsModal } from 'mediasfu-reactjs';

    function BrandedSettings(props) {
    const permissionIcons = {
    allow: '✓',
    disallow: '✗',
    approval: '⚠',
    };

    return (
    <EventSettingsModal
    {...props}
    backgroundColor="#1e3a8a"
    position="topLeft"
    contentProps={{
    style: {
    borderRadius: 20,
    border: '2px solid #3b82f6',
    },
    }}
    saveButtonProps={{
    style: {
    background: 'linear-gradient(135deg, #22c55e 0%, #14532d 100%)',
    color: 'white',
    padding: '12px 28px',
    borderRadius: 12,
    fontWeight: 600,
    },
    }}
    title={
    <div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
    <span>Meeting Permissions</span>
    <div style={{ fontSize: 12, display: 'flex', gap: 8 }}>
    <span>{permissionIcons[props.audioSetting]} Audio</span>
    <span>{permissionIcons[props.videoSetting]} Video</span>
    </div>
    </div>
    }
    />
    );
    }

    // Analytics tracking for permission changes

    import { EventSettingsModal } from 'mediasfu-reactjs';

    function AnalyticsSettings(props) {
    const handleModifySettings = async (options) => {
    analytics.track('event_settings_modified', {
    audioChanged: options.parameters.audioSetting !== props.audioSetting,
    videoChanged: options.parameters.videoSetting !== props.videoSetting,
    screenshareChanged: options.parameters.screenshareSetting !== props.screenshareSetting,
    chatChanged: options.parameters.chatSetting !== props.chatSetting,
    newSettings: {
    audio: options.parameters.audioSetting,
    video: options.parameters.videoSetting,
    screenshare: options.parameters.screenshareSetting,
    chat: options.parameters.chatSetting,
    },
    });
    return props.onModifyEventSettings?.(options);
    };

    return (
    <EventSettingsModal
    {...props}
    onModifyEventSettings={handleModifySettings}
    />
    );
    }

    // Override with MediasfuGeneric uiOverrides

    import { MediasfuGeneric, EventSettingsModal } from 'mediasfu-reactjs';

    const uiOverrides = {
    eventSettingsModal: {
    component: (props) => (
    <EventSettingsModal
    {...props}
    backgroundColor="#0f172a"
    position="topRight"
    saveButtonProps={{
    style: {
    background: '#22c55e',
    borderRadius: 12,
    padding: '12px 28px',
    fontWeight: 600,
    },
    }}
    />
    ),
    },
    };

    <MediasfuGeneric uiOverrides={uiOverrides} />;