Fix audio and video issues

This commit is contained in:
Daniele Pancottini 2023-07-07 17:23:23 +02:00
parent 7a6c877b64
commit 7db0871c8d
2 changed files with 31 additions and 36 deletions

View File

@ -1,29 +1,23 @@
import { Box, Stack, Image, Text } from "@chakra-ui/react"; import { Box, Stack, Image, Text } from '@chakra-ui/react'
export default function VideoCardContent(props: { export default function VideoCardContent(props: {
style: any style: any
resourcePath: string resourcePath: string
resourceCaption: string resourceCaption: string
}) { }) {
return ( return (
<> <>
<Box <Box className={props.style.imageContainer} w={'full'} height={'220px'}>
className={props.style.imageContainer} <video
w={'full'} style={{ width: 'inherit', height: 'inherit' }}
height={'220px'} controls
playsInline
> >
<source src={props.resourcePath} type="video/mp4" />
<video controls >
<source src={props.resourcePath} type="video/mp4"/>
</video> </video>
</Box> </Box>
<Box <Box p={5} className={props.style.captionContainer}>
p={5}
className={props.style.captionContainer}>
<Stack mt={6} align={'center'}> <Stack mt={6} align={'center'}>
<Text padding={0} color={'gray.500'} fontSize={'sm'} align={'center'}> <Text padding={0} color={'gray.500'} fontSize={'sm'} align={'center'}>
{props.resourceCaption} {props.resourceCaption}
@ -32,4 +26,4 @@ export default function VideoCardContent(props: {
</Box> </Box>
</> </>
) )
}; }

View File

@ -239,9 +239,10 @@ export default function RoomPage({
startNodeId: startNode, startNodeId: startNode,
markerStyle: { markerStyle: {
style: { style: {
color: decadesManifest[decade as keyof typeof decadesManifest].color color:
} decadesManifest[decade as keyof typeof decadesManifest].color,
} },
},
}, },
], ],
], ],
@ -319,7 +320,7 @@ export default function RoomPage({
setTimeout(() => { setTimeout(() => {
audioPlayer?.pause() audioPlayer?.pause()
setIsAudioInBackground(false) setIsAudioInBackground(false)
}, audioPlayer!.duration - audioPlayer!.currentTime) }, (audioPlayer!.duration - audioPlayer!.currentTime) * 1000)
} }
}, [isAudioInBackground]) }, [isAudioInBackground])