diff --git a/src/components/Party.js b/src/components/Party.js new file mode 100644 index 0000000..0ec7e87 --- /dev/null +++ b/src/components/Party.js @@ -0,0 +1,17 @@ +import React from "react"; + +import { Flex } from "theme-ui"; + +import PartyVideo from "./PartyVideo"; + +function Party({ streams }) { + return ( + + {Object.entries(streams).map(([id, stream]) => ( + + ))} + + ); +} + +export default Party; diff --git a/src/components/PartyVideo.js b/src/components/PartyVideo.js new file mode 100644 index 0000000..5c8ca1a --- /dev/null +++ b/src/components/PartyVideo.js @@ -0,0 +1,15 @@ +import React, { useRef, useEffect } from "react"; + +function PartyVideo({ stream }) { + const videoRef = useRef(); + + useEffect(() => { + if (videoRef.current) { + videoRef.current.srcObject = stream; + } + }, [stream]); + + return