import React, { useState } from 'react' import stl from './ChatControls.css' import cn from 'classnames' import { Button, Icon } from 'UI' interface Props { stream: MediaStream | null, endCall: () => void } function ChatControls({ stream, endCall } : Props) { const [audioEnabled, setAudioEnabled] = useState(true) const [videoEnabled, setVideoEnabled] = useState(true) const toggleAudio = () => { if (!stream) { return; } const aEn = !audioEnabled stream.getAudioTracks().forEach(track => track.enabled = aEn); setAudioEnabled(aEn); } const toggleVideo = () => { if (!stream) { return; } const vEn = !videoEnabled; stream.getVideoTracks().forEach(track => track.enabled = vEn); setVideoEnabled(vEn) } return (