Files
grungnet/src/components/PartyVideo.js

24 lines
446 B
JavaScript
Raw Normal View History

2020-03-19 12:02:31 +11:00
import React, { useRef, useEffect } from "react";
function PartyVideo({ stream, muted }) {
2020-03-19 12:02:31 +11:00
const videoRef = useRef();
useEffect(() => {
if (videoRef.current) {
videoRef.current.srcObject = stream;
}
}, [stream]);
return (
<video
ref={videoRef}
autoPlay
muted={muted}
style={{ width: "100%", borderRadius: "4px", maxWidth: "500px" }}
playsInline
/>
);
2020-03-19 12:02:31 +11:00
}
export default PartyVideo;