import {useEffect, useRef, useState} from 'react' import {useNetwork} from './useNetwork' const short = (id: string) => id.slice(0, 8) + '…' const btn: React.CSSProperties = { padding: '0.4rem 1rem', borderRadius: 6, border: '1px solid #888', background: '#fff', cursor: 'pointer', fontSize: '1rem' } const primaryBtn: React.CSSProperties = { ...btn, background: '#1a7f37', borderColor: '#1a7f37', color: '#fff' } const dangerBtn: React.CSSProperties = { ...btn, background: '#c62828', borderColor: '#c62828', color: '#fff' } function VideoView({ stream, muted, style }: { stream: MediaStream | null muted: boolean style: React.CSSProperties }) { const ref = useRef(null) useEffect(() => { if (ref.current && ref.current.srcObject !== stream) { ref.current.srcObject = stream } }, [stream]) return