import React from 'react'; import { defineMessages, injectIntl, intlShape } from 'react-intl'; import PropTypes from 'prop-types'; import FullscreenButton from '../video-provider/fullscreen-button/component'; import { styles } from './styles'; const intlMessages = defineMessages({ screenShareLabel: { id: 'app.screenshare.screenShareLabel', description: 'screen share area element label', }, }); class ScreenshareComponent extends React.Component { constructor() { super(); this.state = { loaded: false, }; this.onVideoLoad = this.onVideoLoad.bind(this); } componentDidMount() { const { presenterScreenshareHasStarted } = this.props; presenterScreenshareHasStarted(); } componentWillReceiveProps(nextProps) { const { isPresenter, unshareScreen } = this.props; if (isPresenter && !nextProps.isPresenter) { unshareScreen(); } } componentWillUnmount() { const { presenterScreenshareHasEnded, unshareScreen } = this.props; presenterScreenshareHasEnded(); unshareScreen(); } onVideoLoad() { this.setState({ loaded: true }); } renderFullscreenButton() { const { intl } = this.props; const full = () => { if (!this.videoTag) return; this.videoTag.requestFullscreen(); }; return ( ); } render() { const { loaded } = this.state; const style = { right: 0, bottom: 0, }; return ( [!loaded ? (
) : null, this.renderFullscreenButton(), (