import React, { useState } from 'react' import stl from './ChatControls.css' import cn from 'classnames' import { Button, Icon } from 'UI' import type { LocalStream } from 'Player/MessageDistributor/managers/LocalStream'; interface Props { stream: LocalStream | null, endCall: () => void, videoEnabled: boolean, setVideoEnabled: (boolean) => void } function ChatControls({ stream, endCall, videoEnabled, setVideoEnabled } : Props) { const [audioEnabled, setAudioEnabled] = useState(true) const toggleAudio = () => { if (!stream) { return; } setAudioEnabled(stream.toggleAudio()); } const toggleVideo = () => { if (!stream) { return; } stream.toggleVideo() .then(setVideoEnabled) } return (