using mui for video player

This commit is contained in:
talksik
2022-06-19 12:10:47 -05:00
parent c38c56dc3b
commit 7bb37d0bcd
+14 -2
View File
@@ -1,6 +1,7 @@
import { Container, Grid, Typography } from '@mui/material';
import { CardMedia, Container, Grid, Typography } from '@mui/material';
import React, { useEffect, useMemo, useRef } from 'react';
import { Box } from '@mui/system';
import { MasterConversation } from '../util/types';
// import ConversationDetails from './ConversationDetails';
import { blueGrey } from '@mui/material/colors';
@@ -70,8 +71,19 @@ function Video({ stream }: { stream: MediaStream }) {
useEffect(() => {
if (stream && videoRef.current) {
videoRef.current.srcObject = stream;
videoRef.current.autoplay = true;
videoRef.current.muted = true;
}
}, [stream]);
return <video ref={videoRef} muted autoPlay height={'400'} width={'600'} />;
return (
<Box
component={'video'}
ref={videoRef}
sx={{
height: 300,
boxShadow: 20,
}}
/>
);
}