import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import ReactTooltip from 'react-tooltip'; import classnames from 'classnames'; import * as cookiesManager from '../cookiesManager'; import * as appPropTypes from './appPropTypes'; import { withRoomContext } from '../RoomContext'; import * as stateActions from '../redux/stateActions'; import PeerView from './PeerView'; class Me extends React.Component { constructor(props) { super(props); this._mounted = false; this._rootNode = null; } render() { const { roomClient, connected, me, audioProducer, videoProducer, faceDetection, onSetStatsPeerId } = this.props; let micState; if (!me.canSendMic) micState = 'unsupported'; else if (!audioProducer) micState = 'unsupported'; else if (!audioProducer.paused) micState = 'on'; else micState = 'off'; let webcamState; if (!me.canSendWebcam) webcamState = 'unsupported'; else if (videoProducer && videoProducer.type !== 'share') webcamState = 'on'; else webcamState = 'off'; let changeWebcamState; if (Boolean(videoProducer) && videoProducer.type !== 'share' && me.canChangeWebcam) changeWebcamState = 'on'; else changeWebcamState = 'unsupported'; let shareState; if (Boolean(videoProducer) && videoProducer.type === 'share') shareState = 'on'; else shareState = 'off'; const videoVisible = Boolean(videoProducer) && !videoProducer.paused; let tip; if (!me.displayNameSet) tip = 'Click on your name to change it'; return (