more progress but calling not working now
This commit is contained in:
@@ -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} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user