Audio Input Silence Events - React
VideoSDK provides the onAudioInputSilence event to help you detect when a local participant's microphone is enabled but is not capturing any audio.
You can use this event to notify participants when their microphone may not be working as expected and guide them to check or switch their audio input device.
onAudioInputSilence
The onAudioInputSilence event is triggered when the local participant's microphone is enabled but stops capturing any audio signal. It is triggered again when audio capture resumes, with state set to resolved.
The event callback provides the following information:
| Parameter | Type | Description |
|---|---|---|
state | string | Indicates whether silence was detected or resolved. |
deviceLabel | string | The label of the audio input device, when available. |
timestamp | number | The time at which the event occurred, in milliseconds since Unix epoch. |
state
The state parameter can have one of the following values:
detected— The microphone is enabled, but no audio signal is being captured.resolved— Audio input has resumed after silence was previously detected.
You can subscribe to this event using the useMeeting hook.
The onAudioInputSilence event is not supported on Android mobile web browsers.
Important Considerations
Keep the following points in mind when handling this event:
- Common reasons for audio input silence include:
- A physical mute switch on a headset or microphone is enabled.
- Another application is using the microphone.
- The participant has answered a phone call while using a mobile browser.
- The microphone or its driver is not functioning correctly.
- A Bluetooth headset has switched its active connection to another device.
- This event is sent only to the local participant. Other participants are not notified through this event.
- Muting the microphone through your application does not trigger
onAudioInputSilence. - If the participant turns their microphone off, no
resolvedevent is generated because the microphone is no longer being monitored for input. - Audio input is checked periodically. As a result, there may be a short delay between the microphone becoming silent and the
detectedevent being triggered. - A
resolvedevent is triggered only when silence was previously detected and the microphone starts capturing audio again.
Recommended Usage
When state is detected, you can display a non-blocking notification to the local participant.
For example:
Others can't hear you. Your microphone isn't picking up any sound. Check your microphone or switch to another one.
You can improve the experience by:
- Identifying the affected device. Use
deviceLabelwhen available so the participant knows which microphone is affected. - Allowing the participant to switch microphones. Provide an option to select another audio input device. See the Change Input Device guide.
- Keeping the warning visible until the issue is resolved. Remove the warning when a
resolvedevent is received or when the participant turns off their microphone. - Avoiding automatic actions. Do not automatically mute the microphone, leave the meeting, or rejoin the meeting based only on this event. Let the participant decide how to resolve the issue.
- Logging the event for troubleshooting. If you maintain client-side logs, recording
deviceLabel,state, andtimestampcan help diagnose audio input issues.
Example
The following example shows how to display a warning when the local microphone stops capturing audio:
import { useEffect, useState } from "react";
import { useMeeting } from "@videosdk.live/react-sdk";
function MicSilenceWarning() {
const [silentDevice, setSilentDevice] = useState(null);
const onAudioInputSilence = ({ deviceLabel, state, timestamp }) => {
console.log("onAudioInputSilence", {
deviceLabel,
state,
timestamp,
});
if (state === "detected") {
setSilentDevice(deviceLabel || "Your microphone");
} else if (state === "resolved") {
setSilentDevice(null);
}
};
const { localMicOn } = useMeeting({
onAudioInputSilence,
});
useEffect(() => {
// Clear the warning when the microphone is turned off
if (!localMicOn) {
setSilentDevice(null);
}
}, [localMicOn]);
if (!silentDevice) {
return null;
}
return (
<p>
Others can't hear you. {silentDevice} isn't picking up any sound.
Check your microphone or switch to another one.
</p>
);
}
In this example:
detecteddisplays a warning to the local participant.resolvedremoves the warning when audio input resumes.- Turning the microphone off also removes the warning.
deviceLabelis used to identify the microphone when the device label is available.
API Reference
The API references for all the methods and events utilized in this guide are provided below.
Got a Question? Ask us on discord

