import React from 'react'; import { StyleProp, ViewStyle } from 'react-native'; import { SwitchAudioOptions, SwitchAudioParameters } from '../../methods/streamMethods/switchAudio'; import { SwitchVideoOptions, SwitchVideoParameters } from '../../methods/streamMethods/switchVideo'; import { SwitchVideoAltOptions, SwitchVideoAltParameters } from '../../methods/streamMethods/switchVideoAlt'; /** * Parameters for media settings state and device management. * * @interface MediaSettingsModalParameters * @extends SwitchAudioParameters * @extends SwitchVideoParameters * @extends SwitchVideoAltParameters * * **Default Devices:** * @property {string} userDefaultVideoInputDevice Currently selected video input device ID. * @property {string} userDefaultAudioInputDevice Currently selected audio input device ID. * * **Available Devices:** * @property {MediaDeviceInfo[]} videoInputs Enumerated list of camera devices. * @property {MediaDeviceInfo[]} audioInputs Enumerated list of microphone devices. * * **Background Modal:** * @property {boolean} isBackgroundModalVisible Flag indicating if the background effect modal is open. * @property {(visible: boolean) => void} updateIsBackgroundModalVisible Updates the visibility of the background modal. * * **Utility:** * @property {() => MediaSettingsModalParameters} getUpdatedAllParams Retrieves the latest parameter snapshot for downstream consumers. */ export interface MediaSettingsModalParameters extends SwitchAudioParameters, SwitchVideoParameters, SwitchVideoAltParameters { userDefaultVideoInputDevice: string; videoInputs: MediaDeviceInfo[]; audioInputs: MediaDeviceInfo[]; userDefaultAudioInputDevice: string; isBackgroundModalVisible: boolean; updateIsBackgroundModalVisible: (visible: boolean) => void; getUpdatedAllParams: () => MediaSettingsModalParameters; } /** * Configuration options for the `MediaSettingsModal` component. * * @interface MediaSettingsModalOptions * * **Modal Control:** * @property {boolean} isMediaSettingsModalVisible Toggles visibility of the media settings modal. * @property {() => void} onMediaSettingsClose Callback invoked when the modal should close. * * **Device Switch Handlers:** * @property {(options: SwitchVideoAltOptions) => Promise} [switchCameraOnPress=switchVideoAlt] Handler for flipping between device cameras. * @property {(options: SwitchVideoOptions) => Promise} [switchVideoOnPress=switchVideo] Handler for changing the active video input. * @property {(options: SwitchAudioOptions) => Promise} [switchAudioOnPress=switchAudio] Handler for changing the active audio input. * * **State Parameters:** * @property {MediaSettingsModalParameters} parameters Current device selections and available devices. * * **Customization:** * @property {'topRight' | 'topLeft' | 'bottomRight' | 'bottomLeft'} [position='topRight'] Modal anchoring position. * @property {string} [backgroundColor='#83c0e9'] Background color of the modal surface. * @property {StyleProp} [style] Additional styling applied to the modal container. * * **Advanced Render Overrides:** * @property {(options: { defaultContent: JSX.Element; dimensions: { width: number; height: number } }) => JSX.Element} [renderContent] Override for the modal content body. * @property {(options: { defaultContainer: JSX.Element; dimensions: { width: number; height: number } }) => JSX.Element} [renderContainer] Override for the modal container wrapper. */ export interface MediaSettingsModalOptions { /** * Determines if the media settings modal is visible. */ isMediaSettingsModalVisible: boolean; /** * Callback function to close the media settings modal. */ onMediaSettingsClose: () => void; /** * Function to handle camera switch action. * @default switchVideoAlt */ switchCameraOnPress?: (options: SwitchVideoAltOptions) => Promise; /** * Function to handle video input switch action. * @default switchVideo */ switchVideoOnPress?: (options: SwitchVideoOptions) => Promise; /** * Function to handle audio input switch action. * @default switchAudio */ switchAudioOnPress?: (options: SwitchAudioOptions) => Promise; /** * Parameters containing user default devices and available devices. */ parameters: MediaSettingsModalParameters; /** * Position of the modal on the screen. * @default "topRight" */ position?: 'topRight' | 'topLeft' | 'bottomRight' | 'bottomLeft'; /** * Background color of the modal. * @default "#83c0e9" */ backgroundColor?: string; /** * Optional custom style for the modal container. */ style?: StyleProp; /** * Custom render function for modal content. */ renderContent?: (options: { defaultContent: JSX.Element; dimensions: { width: number; height: number; }; }) => JSX.Element; /** * Custom render function for the modal container. */ renderContainer?: (options: { defaultContainer: JSX.Element; dimensions: { width: number; height: number; }; }) => JSX.Element; } export type MediaSettingsModalType = (options: MediaSettingsModalOptions) => JSX.Element; /** * MediaSettingsModal - Audio/video device selection interface. * * Offers participants a guided control surface for swapping microphones, * cameras, and launching background effects. Designed for quick device * management across desktop and mobile with override hooks for bespoke UI. * * **Key Features:** * - Enumerates available audio and video input devices with friendly labels. * - Provides camera flip support on mobile via `switchCameraOnPress`. * - Integrates background effect modal visibility toggles. * - Applies device switches instantly using supplied handler callbacks. * - Supports modal placement at any screen corner. * - Accepts additional styling through the `style` prop for brand alignment. * - Exposes override hooks to replace default content or container markup. * - Relies on `getUpdatedAllParams` for up-to-date device inventories. * * **UI Customization:** * Replace via `uiOverrides.mediaSettingsModal` to deliver a tailored media * settings panel while continuing to use the provided stream utilities. * * @component * @param {MediaSettingsModalOptions} props Component properties. * @returns {JSX.Element} Rendered media settings modal. * * @example * ```tsx * // Basic device selection workflow * setVisible(false)} * parameters={parameters} * /> * ``` * * @example * ```tsx * // Custom switch handlers * * ``` * * @example * ```tsx * // uiOverrides integration for branded dialog * const MediaSettings = withOverride(uiOverrides.mediaSettingsModal, MediaSettingsModal); * * ``` */ declare const MediaSettingsModal: React.FC; export default MediaSettingsModal;