Update video element when the call changes in a videoview

Because that can happen now
This commit is contained in:
David Baker 2020-12-04 19:41:48 +00:00
parent 02d1249cfc
commit faf2922b1b

View file

@ -42,10 +42,12 @@ export default class VideoFeed extends React.Component<IProps> {
componentDidMount() {
this.vid.current.addEventListener('resize', this.onResize);
if (this.props.type === VideoFeedType.Local) {
this.props.call.setLocalVideoElement(this.vid.current);
} else {
this.props.call.setRemoteVideoElement(this.vid.current);
this.setVideoElement();
}
componentDidUpdate(prevProps) {
if (this.props.call !== prevProps.call) {
this.setVideoElement();
}
}
@ -53,6 +55,14 @@ export default class VideoFeed extends React.Component<IProps> {
this.vid.current.removeEventListener('resize', this.onResize);
}
private setVideoElement() {
if (this.props.type === VideoFeedType.Local) {
this.props.call.setLocalVideoElement(this.vid.current);
} else {
this.props.call.setRemoteVideoElement(this.vid.current);
}
}
onResize = (e) => {
if (this.props.onResize) {
this.props.onResize(e);