more progress but calling not working now

This commit is contained in:
talksik
2022-05-19 11:51:17 -05:00
parent efc63df98f
commit d58a628589
4 changed files with 40 additions and 69 deletions
@@ -45,45 +45,3 @@ export default function MainPanel() {
</div>
);
}
function LineStreams({ broadcasters }: { broadcasters: string[] }) {
const { peerMap } = useStreams();
console.log(peerMap);
return (
<div className="flex flex-col">
{broadcasters?.map((userId) => {
const currentPeer = peerMap[userId];
return currentPeer && <Stream key={`streamDisplay-${userId}`} peer={currentPeer} />;
})}
this is the list of current streams we are going to show
</div>
);
}
function Stream({ peer }: { peer: Peer }) {
const streamRef = useRef<HTMLVideoElement>(null);
useEffect(() => {
peer.on('stream', (remotePeerStream: MediaStream) => {
console.log(
'stream coming in from remote peer...BUT, only going to show once they broadcast',
);
console.log(peer);
// const audio = new Audio();
// audio.autoplay = true;
// audio.srcObject = remotePeerStream;
if (streamRef?.current) streamRef.current.srcObject = remotePeerStream;
});
}, []);
return (
<>
this is a stream component of one remote peer
<video height={400} width={400} autoPlay muted ref={streamRef} />
</>
);
}