mirror of https://github.com/vector-im/riot-web
Update video element when the call changes in a videoview
Because that can happen nowpull/21833/head
parent
02d1249cfc
commit
faf2922b1b
|
@ -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 New Issue