37 lines
960 B
JavaScript
Executable File
37 lines
960 B
JavaScript
Executable File
import React from 'react';
|
|
|
|
import { styles } from './styles';
|
|
|
|
export default class ScreenshareComponent extends React.Component {
|
|
constructor() {
|
|
super();
|
|
this.state = {
|
|
loaded: false,
|
|
};
|
|
|
|
this.onVideoLoad = this.onVideoLoad.bind(this);
|
|
}
|
|
componentDidMount() {
|
|
this.props.presenterScreenshareHasStarted();
|
|
}
|
|
componentWillReceiveProps(nextProps) {
|
|
if (this.props.isPresenter && !nextProps.isPresenter) {
|
|
this.props.unshareScreen();
|
|
}
|
|
}
|
|
componentWillUnmount() {
|
|
this.props.presenterScreenshareHasEnded();
|
|
this.props.unshareScreen();
|
|
}
|
|
onVideoLoad() {
|
|
this.setState({ loaded: true });
|
|
}
|
|
|
|
render() {
|
|
return (
|
|
[!this.state.loaded ? (<div key="screenshareArea" className={styles.connecting} />) : null,
|
|
(<video key="screenshareVideo" id="screenshareVideo" style={{ maxHeight: '100%', width: '100%' }} autoPlay playsInline onLoadedData={this.onVideoLoad} />)]
|
|
);
|
|
}
|
|
}
|