diff --git a/src/components/Room/PeerVideo.tsx b/src/components/Room/PeerVideo.tsx index e8ae900..149fe73 100644 --- a/src/components/Room/PeerVideo.tsx +++ b/src/components/Room/PeerVideo.tsx @@ -2,12 +2,22 @@ import { useEffect, useRef } from 'react' import Paper from '@mui/material/Paper' import { PeerNameDisplay } from 'components/PeerNameDisplay' +import { VideoStreamType } from 'models/chat' + +import { SelectedPeerStream } from './RoomVideoDisplay' interface PeerVideoProps { isSelfVideo?: boolean numberOfVideos: number + onVideoClick?: ( + userId: string, + videoStreamType: VideoStreamType, + videoStream: MediaStream + ) => void + selectedPeerStream: SelectedPeerStream | null userId: string videoStream: MediaStream + videoStreamType: VideoStreamType } // Adapted from https://www.geeksforgeeks.org/find-the-next-perfect-square-greater-than-a-given-number/ @@ -20,8 +30,11 @@ const nextPerfectSquare = (base: number) => { export const PeerVideo = ({ isSelfVideo, numberOfVideos, + onVideoClick, userId, + selectedPeerStream, videoStream, + videoStreamType, }: PeerVideoProps) => { const videoRef = useRef(null) @@ -35,6 +48,10 @@ export const PeerVideo = ({ const sizePercent = 100 / Math.sqrt(nextPerfectSquare(numberOfVideos - 1)) + const handleVideoClick = () => { + onVideoClick?.(userId, videoStreamType, videoStream) + } + return (