import { IconLookup } from '@fortawesome/fontawesome-svg-core'; import { faPhoneSlash, faSync } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { action, observable } from 'mobx'; import { observer } from 'mobx-react'; import * as React from 'react'; import { Doc } from '../../../fields/Doc'; import { InkTool } from '../../../fields/InkField'; import { SnappingManager } from '../../util/SnappingManager'; import '../../views/nodes/WebBox.scss'; import { FieldView, FieldViewProps } from '../nodes/FieldView'; import './DashWebRTCVideo.scss'; import { hangup, initialize, refreshVideos } from './WebCamLogic'; /** * This models the component that will be rendered, that can be used as a doc that will reflect the video cams. */ @observer export class DashWebRTCVideo extends React.Component { private roomText: HTMLInputElement | undefined; @observable remoteVideoAdded: boolean = false; @action changeUILook = () => (this.remoteVideoAdded = true); /** * Function that submits the title entered by user on enter press. */ private onEnterKeyDown = (e: React.KeyboardEvent) => { if (e.keyCode === 13) { const submittedTitle = this.roomText!.value; this.roomText!.value = ''; this.roomText!.blur(); initialize(submittedTitle, this.changeUILook); } }; public static LayoutString(fieldKey: string) { return FieldView.LayoutString(DashWebRTCVideo, fieldKey); } onClickRefresh = () => refreshVideos(); onClickHangUp = () => hangup(); render() { const content = (
DashWebRTC
(this.roomText = e!)} onKeyDown={this.onEnterKeyDown} />
); const frozen = !this.props.isSelected() || SnappingManager.IsResizing; const classname = 'webBox-cont' + (this.props.isSelected() && Doc.ActiveTool === InkTool.None && !SnappingManager.IsResizing ? '-interactive' : ''); return ( <>
{content}
{!frozen ? null :
} ); } }