Function: useMicrophone()
useMicrophone():
object
Defined in: packages/react-client/src/hooks/devices/useMicrophone.ts:9
Manage microphone
Returns
object
activeMicrophone
activeMicrophone:
null
|DeviceItem
=microphoneManager.activeDevice
Indicates which microphone is now turned on and streaming audio
currentMicrophoneMiddleware
currentMicrophoneMiddleware:
TrackMiddleware
=audioTrackManager.currentMiddleware
The currently set microphone middleware function
isMicrophoneMuted
isMicrophoneMuted:
boolean
=!microphoneManager.deviceEnabled
Indicates whether the microphone is muted
isMicrophoneOn
isMicrophoneOn:
boolean
=!!microphoneStream
Indicates whether the microphone is streaming audio
microphoneDeviceError
microphoneDeviceError:
null
|DeviceError
=microphoneManager.deviceError
Possible error thrown while setting up the microphone
microphoneDevices
microphoneDevices:
DeviceItem
[] =microphoneManager.deviceList
List of available microphone devices
microphoneStream
microphoneStream:
null
|MediaStream
The MediaStream object containing the current audio stream
selectMicrophone()
selectMicrophone: (
deviceId
?) =>Promise
<undefined
|DeviceError
> =audioTrackManager.selectDevice
Selects the microphone device
Parameters
Parameter | Type |
---|---|
deviceId ? | string |
Returns
Promise
<undefined
| DeviceError
>
setMicrophoneTrackMiddleware()
setMicrophoneTrackMiddleware: (
middleware
) =>Promise
<void
> =audioTrackManager.setTrackMiddleware
Sets the microphone middleware
Parameters
Parameter | Type |
---|---|
middleware | TrackMiddleware |
Returns
Promise
<void
>
toggleMicrophone()
toggleMicrophone: () =>
Promise
<undefined
|DeviceError
> =audioTrackManager.toggleDevice
Toggles current microphone on/off
Returns
Promise
<undefined
| DeviceError
>
toggleMicrophoneMute()
toggleMicrophoneMute: () =>
Promise
<void
> =audioTrackManager.toggleMute
Mutes/unmutes the microphone
Returns
Promise
<void
>