Add audio functionality to videos
co-authored-by: mitchemmc <mitchemmc@gmail.com>
This commit is contained in:
parent
eb4f3d2a26
commit
e92129d8ea
|
@ -4,11 +4,11 @@ import { Flex } from "theme-ui";
|
|||
|
||||
import PartyVideo from "./PartyVideo";
|
||||
|
||||
function Party({ streams }) {
|
||||
function Party({ streams, localStreamId }) {
|
||||
return (
|
||||
<Flex p={4} bg="highlight" sx={{ flexDirection: "column", width: "200px" }}>
|
||||
{Object.entries(streams).map(([id, stream]) => (
|
||||
<PartyVideo key={id} stream={stream} />
|
||||
<PartyVideo key={id} stream={stream} muted={id === localStreamId}/>
|
||||
))}
|
||||
</Flex>
|
||||
);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import React, { useRef, useEffect } from "react";
|
||||
|
||||
function PartyVideo({ stream }) {
|
||||
function PartyVideo({ stream, muted }) {
|
||||
const videoRef = useRef();
|
||||
|
||||
useEffect(() => {
|
||||
|
@ -9,7 +9,7 @@ function PartyVideo({ stream }) {
|
|||
}
|
||||
}, [stream]);
|
||||
|
||||
return <video ref={videoRef} autoPlay muted />;
|
||||
return <video ref={videoRef} autoPlay muted={muted} />;
|
||||
}
|
||||
|
||||
export default PartyVideo;
|
||||
|
|
|
@ -83,7 +83,7 @@ function Game() {
|
|||
/>
|
||||
</Box>
|
||||
</Flex>
|
||||
<Party streams={streams} />
|
||||
<Party streams={streams} localStreamId={peerId} />
|
||||
<Flex sx={{ justifyContent: "center" }}>
|
||||
<Image src={imageSource} />
|
||||
</Flex>
|
||||
|
|
Loading…
Reference in New Issue
Block a user