Skip to main content
Version: 0.1.x

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 useParticipant hook.

onStreamDisabled()

  • This event is triggered whenever a participant's video, audio or screen share stream is disabled.
  • It can be subscribed to using the useParticipant hook.

onMediaStatusChanged()

  • This event is triggered whenever a participant's video or audio stream is disabled or enabled.
  • It can be subscribed to using the useParticipant hook.

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,
...
});

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