Derive mute state from props

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner 2021-06-12 12:16:52 +02:00
parent 0c55a6c5bf
commit ed148de567
No known key found for this signature in database
GPG key ID: 9760693FDD98A790

View file

@ -73,6 +73,13 @@ export default class VideoFeed extends React.Component<IProps, IState> {
this.updateFeed(prevProps.feed, this.props.feed); this.updateFeed(prevProps.feed, this.props.feed);
} }
static getDerivedStateFromProps(props: IProps) {
return {
audioMuted: props.feed.isAudioMuted(),
videoMuted: props.feed.isVideoMuted(),
};
}
private updateFeed(oldFeed: CallFeed, newFeed: CallFeed) { private updateFeed(oldFeed: CallFeed, newFeed: CallFeed) {
if (oldFeed === newFeed) return; if (oldFeed === newFeed) return;