Added video calling
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import React from "react";
|
||||
|
||||
import { Flex } from "theme-ui";
|
||||
|
||||
import PartyVideo from "./PartyVideo";
|
||||
|
||||
function Party({ streams }) {
|
||||
return (
|
||||
<Flex p={4} bg="highlight" sx={{ flexDirection: "column", width: "200px" }}>
|
||||
{Object.entries(streams).map(([id, stream]) => (
|
||||
<PartyVideo key={id} stream={stream} />
|
||||
))}
|
||||
</Flex>
|
||||
);
|
||||
}
|
||||
|
||||
export default Party;
|
||||
@@ -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 <video ref={videoRef} autoPlay muted />;
|
||||
}
|
||||
|
||||
export default PartyVideo;
|
||||
@@ -1,6 +1,5 @@
|
||||
import React from "react";
|
||||
import Draggable from "react-draggable";
|
||||
import { Styled } from "theme-ui";
|
||||
|
||||
function Token({ onDrag, position }) {
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user