Skip to main content
Version: 1.x.x

Pause/Resume Video Stream - React Native

Whenver you wish to stop/resume downlaod stream(webcam, screenShare and mic) of participant, you can simply do it by using pause, resume methods.

note

This page uses the following asynchronous methods. Refer to their API reference for the errors each Promise may reject with, and handle these rejections appropriately based on your use case.

Pause video stream​

  • pause() method is used for pause stream(webcam, screenShare and mic) of a particular participant.
import { useParticipant } from "@videosdk.live/react-native-sdk";

const ParticipantView = () => {
// get stream of particular participant
const { webcamStream, micStream, screenShareStream } =
useParticipant("<ParticipantId>");

const onPress = async () => {
// pause video stream
webcamStream.pause();

// pause mic stream
micStream.pause();

// pause screen share stream
try {
await screenShareStream.pause();
} catch (err) {
console.error("pause failed:", err);
}
};

return <>...</>;
};

Resume video stream​

  • resume() method is used to resume stream(webcam, screenShare and mic) of a particular participant.
import { useParticipant } from "@videosdk.live/react-native-sdk";

const ParticipantView = () => {
// get stream of particular participant
const { webcamStream, micStream, screenShareStream } =
useParticipant("<ParticipantId>");

const onPress = async () => {
// resume video stream
webcamStream.resume();

// resume mic stream
micStream.resume();

// resume screen share stream
try {
await screenShareStream.resume();
} catch (err) {
console.error("resume failed:", err);
}
};

return <>...</>;
};

Got a Question? Ask us on discord