onMicrophoneTurnOnByOthersConfirmation property

(Future<bool> Function(BuildContext context)?) onMicrophoneTurnOnByOthersConfirmation
getter/setter pair

This callback method is called when someone requests to open your microphone, typically when the host wants to open the speaker's microphone. This method requires returning an asynchronous result. You can display a dialog in this callback to confirm whether to open the microphone. Alternatively, you can return true without any processing, indicating that when someone requests to open your microphone, it can be directly opened. By default, this method does nothing and returns false, indicating that others cannot open your microphone.

Example:


 // eg:
..onMicrophoneTurnOnByOthersConfirmation =
    (BuildContext context) async {
  const textStyle = TextStyle(
    fontSize: 10,
    color: Colors.white70,
  );

  return await showDialog(
    context: context,
    barrierDismissible: false,
    builder: (BuildContext context) {
      return AlertDialog(
        backgroundColor: Colors.blue[900]!.withOpacity(0.9),
        title: const Text(
          'You have a request to turn on your microphone',
          style: textStyle,
        ),
        content: const Text(
          'Do you agree to turn on the microphone?',
          style: textStyle,
        ),
        actions: [
          ElevatedButton(
            child: const Text('Cancel', style: textStyle),
            onPressed: () => Navigator.of(context).pop(false),
          ),
          ElevatedButton(
            child: const Text('OK', style: textStyle),
            onPressed: () {
              Navigator.of(context).pop(true);
            },
          ),
        ],
      );
    },
  );
},

Implementation

Future<bool> Function(BuildContext context)?
    onMicrophoneTurnOnByOthersConfirmation;