using mui for video player
This commit is contained in:
@@ -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 React, { useEffect, useMemo, useRef } from 'react';
|
||||||
|
|
||||||
|
import { Box } from '@mui/system';
|
||||||
import { MasterConversation } from '../util/types';
|
import { MasterConversation } from '../util/types';
|
||||||
// import ConversationDetails from './ConversationDetails';
|
// import ConversationDetails from './ConversationDetails';
|
||||||
import { blueGrey } from '@mui/material/colors';
|
import { blueGrey } from '@mui/material/colors';
|
||||||
@@ -70,8 +71,19 @@ function Video({ stream }: { stream: MediaStream }) {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (stream && videoRef.current) {
|
if (stream && videoRef.current) {
|
||||||
videoRef.current.srcObject = stream;
|
videoRef.current.srcObject = stream;
|
||||||
|
videoRef.current.autoplay = true;
|
||||||
|
videoRef.current.muted = true;
|
||||||
}
|
}
|
||||||
}, [stream]);
|
}, [stream]);
|
||||||
|
|
||||||
return <video ref={videoRef} muted autoPlay height={'400'} width={'600'} />;
|
return (
|
||||||
|
<Box
|
||||||
|
component={'video'}
|
||||||
|
ref={videoRef}
|
||||||
|
sx={{
|
||||||
|
height: 300,
|
||||||
|
boxShadow: 20,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user