Media Events - React Native
VideoSDK provides multiple types of events which can be listened to know the about the participant's media status in the meeting.
Here are the events which specifically relate to the stream.
onStreamEnabled
- This event is triggered whenever a participant's video, audio or screen share stream is enabled.
- This event can be subscribed from the
useParticipant
hook.
onStreamDisabled
- This event is triggered whenever a participant's video, audio or screen share stream is disabled.
- This event can be subscribed from the
useParticipant
hook.
onMediaStatusChanged
- This event will be triggered whenever a participant's video or audio is disabled or enabled.
- This event can be subscribed from the
useParticipant
hook.
Example
Here is the usage of all the events mentioned in 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 utilised in this guide are provided below.
Got a Question? Ask us on discord