Skip to main content

Function: useMicrophone()

useMicrophone(): object

Defined in: packages/react-client/src/hooks/devices/useMicrophone.ts:8

Manage microphone

Returns

object

activeMicrophone

activeMicrophone: null | DeviceItem = deviceApi.activeDevice

Indicates which microphone is now turned on and streaming audio

currentMicrophoneMiddleware

currentMicrophoneMiddleware: TrackMiddleware = deviceApi.currentMiddleware

The currently set microphone middleware function

isMicrophoneMuted

isMicrophoneMuted: boolean = audioTrackManager.paused

Indicates whether the microphone is muted

isMicrophoneOn

isMicrophoneOn: boolean = !!deviceApi.mediaStream

Indicates whether the microphone is streaming audio

microphoneDeviceError

microphoneDeviceError: null | DeviceError = deviceApi.deviceError

Possible error thrown while setting up the microphone

microphoneDevices

microphoneDevices: DeviceItem[] = deviceApi.devices

List of available microphone devices

microphoneStream

microphoneStream: null | MediaStream = deviceApi.mediaStream

The MediaStream object containing the current audio stream

selectMicrophone()

selectMicrophone: (deviceId?) => Promise<void> = audioTrackManager.selectDevice

Selects the microphone device

Parameters

ParameterType
deviceId?string

Returns

Promise<void>

setMicrophoneTrackMiddleware()

setMicrophoneTrackMiddleware: (middleware) => Promise<void> = audioTrackManager.setTrackMiddleware

Sets the microphone middleware

Parameters

ParameterType
middlewareTrackMiddleware

Returns

Promise<void>

toggleMicrophone()

toggleMicrophone: () => Promise<void> = audioTrackManager.toggleDevice

Toggles current microphone on/off

Returns

Promise<void>

toggleMicrophoneMute()

toggleMicrophoneMute: () => Promise<void> = audioTrackManager.toggleMute

Mutes/unmutes the microphone

Returns

Promise<void>