Drag the Video
Video in view: false
import { useVideo } from "@100mslive/react-sdk";

function Peer({ peer }) {
  const { videoRef } = useVideo({
    trackId: peer.videoTrack,
    threshold: 0.5,
  });
  return <video ref={videoRef} autoPlay muted playsInline />;
}
export default Peer;

useVideo hook will return an object videoRef given a video trackId. The returned videoRef can be used to set on a video element meant to display the video.

The hook will take care of attaching and detaching video, and will automatically detach when the video goes out of view to save on bandwidth.