Update video element when the call changes in a videoview
Because that can happen now
This commit is contained in:
parent
02d1249cfc
commit
faf2922b1b
1 changed files with 14 additions and 4 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue