Skip to main content
useInputSettings(params?) : Object

Parameters (optional)

onError
Function
Callback for the 'input-settings-error' event.
onInputSettingsUpdated
Function
Callback for the input-settings-updated event.

Return value

An object with the following properties:
errorMsg
string
Details an input settings error. Defaults to null.
inputSettings
Object
The settings for the participant. See daily-js instance method getInputSettings() for an overview of input settings.
updateInputSettings
Function
Updates input settings, equivalent to calling the daily-js updateInputSettings() method.
Any calls to updateInputSettings() before the meeting is joined will be silently ignored.

Example

import { DailyEventObjectInputSettingsUpdated } from '@daily-co/daily-js';
import { useInputSettings } from '@daily-co/daily-react';
import React, { useCallback, useState } from 'react';

export const UseInputSettingsDemo = () => {
  const [, setErrorMessage] = useState('No error!');

  const { updateInputSettings, errorMsg } = useInputSettings({
    onError: useCallback(() => {
      setErrorMessage(errorMsg);
    }, [errorMsg]),

    onInputSettingsUpdated: useCallback(
      (event: DailyEventObjectInputSettingsUpdated) => {
        console.log(
          'Input settings updated:',
          event.inputSettings?.video?.processor
        );
      },
      []
    ),
  });

  const enableBackgroundBlur = () => {
    updateInputSettings({
      video: {
        processor: {
          type: 'background-blur',
          config: { strength: 0.5 },
        },
      },
    });
  };

  return (
    <div>
      <button type="button" onClick={enableBackgroundBlur}>
        Enable background blur
      </button>
    </div>
  );
};

See also