Skip to main content
Version: 2.x.x

Monitoring Remote Participants' Stream - React Native

Monitoring the state of a remote participant’s stream helps ensure a consistent and high-quality room experience. The onStreamStateChanged event accessible from the useRTCStream hook provides real-time updates whenever the condition of a remote video or screenshare video stream changes — allowing your app to detect issues and respond accordingly.

By subscribing to this event, you can track when a stream becomes active, stuck, or experiences a freeze, and take corrective actions or inform users as needed.

note

This event is emitted exclusively for remote participants, specifically for their video and screen share video streams.

Why It Matters​

Use this event to:

  • Detect when a remote participant’s video freezes or becomes stuck.
  • Notify local participants about possible issues.
  • Log state transitions for diagnostics or quality metrics.

Example Usage​

import { useParticipant, useRTCStream } from "@videosdk.live/react-native-sdk";

function onStreamStateChanged(data) {
const { state, timestamp } = data;
console.log(`Stream state is ${state} at ${timestamp}`);
}

function RemoteParticipantView({ participantId }) {
const { webcamStream } = useParticipant(participantId);

useRTCStream(webcamStream?.id, {
onStreamStateChanged,
});

return null;
}
  • state is one of ACTIVE, STUCK, FREEZE_DETECTED, FREEZE_RESOLVED or ENDED.

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