Skip to main content
Version: 2.x.x

Monitoring Remote Participants' Stream - React Native

The onStreamStateChanged event of the useRTCStream hook fires whenever the state of a remote video or screen share stream changes, so your app can detect a problem and respond.

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