You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-11 20:22:36 +03:00
Update video element when the call changes in a videoview
Because that can happen now
This commit is contained in:
@@ -42,10 +42,12 @@ export default class VideoFeed extends React.Component<IProps> {
|
|||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.vid.current.addEventListener('resize', this.onResize);
|
this.vid.current.addEventListener('resize', this.onResize);
|
||||||
if (this.props.type === VideoFeedType.Local) {
|
this.setVideoElement();
|
||||||
this.props.call.setLocalVideoElement(this.vid.current);
|
}
|
||||||
} else {
|
|
||||||
this.props.call.setRemoteVideoElement(this.vid.current);
|
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);
|
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) => {
|
onResize = (e) => {
|
||||||
if (this.props.onResize) {
|
if (this.props.onResize) {
|
||||||
this.props.onResize(e);
|
this.props.onResize(e);
|
||||||
|
|||||||
Reference in New Issue
Block a user