bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/screenshare/component.jsx

37 lines
960 B
React
Raw Normal View History

import React from 'react';
import { styles } from './styles';
export default class ScreenshareComponent extends React.Component {
constructor() {
super();
this.state = {
loaded: false,
};
2018-05-15 22:56:53 +08:00
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();
}
2018-05-15 22:56:53 +08:00
onVideoLoad() {
this.setState({ loaded: true });
}
render() {
return (
2018-07-20 01:42:17 +08:00
[!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} />)]
);
}
}