Media Events - React
VideoSDK offers various events that can be monitored to obtain information about the media status of participants in the meeting.
Here are the events specifically related to the stream:
onStreamEnabled()
- This event is triggered whenever a participant's video, audio or screen share stream is enabled.
- It can be subscribed to using the
useParticipanthook.
onStreamDisabled()
- This event is triggered whenever a participant's video, audio or screen share stream is disabled.
- It can be subscribed to using the
useParticipanthook.
onMediaStatusChanged()
- This event is triggered whenever a participant's video or audio stream is disabled or enabled.
- It can be subscribed to using the
useParticipanthook.
onAudioInputSilence()
- This event is triggered whenever no system-level audio input is received from the local microphone (e.g., input level is zero, microphone not working, or device unavailable). This event is not triggered for normal user silence.
- It can be subscribed to using the
useMeetinghook.
Example
Here is an example demonstrating the usage of all the events mentioned on this page.
function onStreamEnabled(stream) {
console.log(" onStreamEnabled", stream);
}
function onStreamDisabled(stream) {
console.log(" onStreamDisabled", stream);
}
function onMediaStatusChanged(data) {
//kind: It repesents the type of media
//newStatus: It repesents the status of the media
const { kind, newStatus} = data;
}
const {
dislplayName
...
} = useParticipant(participantId, {
onStreamEnabled,
onStreamDisabled,
onMediaStatusChanged,
...
});
function onAudioInputSilence({ devicelabel, state, timestamp }) {
console.log("onAudioInputSilence", {
devicelabel,
state,
timestamp,
});
}
const {
meetingId,
...
} = useMeeting({
onAudioInputSilence,
...
});
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

