import React, { useState, useEffect, FC } from 'react' import VideoContainer from '../components/VideoContainer' import { Icon, Popup } from 'UI' import stl from './chatWindow.css' import { callPeer } from 'App/player' import cn from 'classnames' export interface Props { // call: (oStream: MediaStream, cb: (iStream: MediaStream)=>void)=>void } const ChatWindow: FC = function ChatWindow() { const [minimize, setMinimize] = useState(false) const [ inputStream, setInputStream ] = useState(null); const [ outputStream, setOutputStream ] = useState(null); useEffect(() => { navigator.mediaDevices.getUserMedia({video:true, audio:true}) .then(oStream => { setOutputStream(oStream); const call = callPeer(oStream, setInputStream, () => { console.log('endd') outputStream?.getTracks().forEach(t => t.stop()); //inputStream?. }); // Returns false when unable to connect. // TODO: handle calling state console.log(call) }) .catch(console.log) // TODO: handle error in ui }, []) return (
} content={ `Remote Control` } size="tiny" inverted position="top center" />
) } export default ChatWindow