diff --git a/ui/src/Room.tsx b/ui/src/Room.tsx index 5319f49b..4c03c944 100644 --- a/ui/src/Room.tsx +++ b/ui/src/Room.tsx @@ -1,9 +1,11 @@ import React, {useCallback} from 'react'; -import {Badge, IconButton, Paper, Tooltip, Typography} from '@mui/material'; +import {Badge, Box, IconButton, Paper, Tooltip, Typography, Slider, Stack} from '@mui/material'; import CancelPresentationIcon from '@mui/icons-material/CancelPresentation'; import PresentToAllIcon from '@mui/icons-material/PresentToAll'; import FullScreenIcon from '@mui/icons-material/Fullscreen'; import PeopleIcon from '@mui/icons-material/People'; +import VolumeMuteIcon from '@mui/icons-material/VolumeOff'; +import VolumeIcon from '@mui/icons-material/VolumeUp'; import SettingsIcon from '@mui/icons-material/Settings'; import {useHotkeys} from 'react-hotkeys-hook'; import {Video} from './Video'; @@ -97,7 +99,17 @@ export const Room = ({ React.useEffect(() => { if (videoElement && stream) { videoElement.srcObject = stream; - videoElement.play().catch((e) => console.log('Could not play main video', e)); + videoElement.play().catch((err) => { + console.log('Could not play main video', err); + if (err.name === 'NotAllowedError') { + videoElement.muted = true; + videoElement + .play() + .catch((retryErr) => + console.log('Could not play main video with mute', retryErr) + ); + } + }); } }, [videoElement, stream]); @@ -161,6 +173,15 @@ export const Room = ({ }, [state.clientStreams, selectedStream] ); + useHotkeys( + 'm', + () => { + if (videoElement) { + videoElement.muted = !videoElement.muted; + } + }, + [videoElement] + ); const videoClasses = () => { switch (settings.displayMode) { @@ -194,7 +215,6 @@ export const Room = ({ {stream ? (