Pause/Resume Video Stream - React
Whenver you wish to stop/resume downlaod stream(webcam, screenShare and mic) of participant, you can simply do it by using pause
, resume
methods.
Pause video stream
pause()
method is used for pause stream(webcam, screenShare and mic) of a particular participant.
import { useParticipant } from "@videosdk.live/react-sdk";
// get stream of particular participant
const { webcamStream, micStream, screenShareStream } =
useParticipant("<ParticipantId>");
const onPress = () => {
// pause video stream
webcamStream.pause();
// pause mic stream
micStream.pause();
// pause screen share stream
screenShareStream.pause();
};
Resume video stream
resume()
method is used to resume stream(webcam, screenShare and mic) of a particular participant.
import { useParticipant } from "@videosdk.live/react-sdk";
// get stream of particular participant
const { webcamStream, micStream, screenShareStream } =
useParticipant("<ParticipantId>");
const onPress = () => {
// resume video stream
webcamStream.resume();
// resume mic stream
micStream.resume();
// resume screen share stream
screenShareStream.resume();
};
Got a Question? Ask us on discord