Handle mute state changes

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner 2021-07-27 14:31:42 +02:00
parent 50c27ebed7
commit 5dd34de5fe
No known key found for this signature in database
GPG key ID: 55C211A1226CB17D

View file

@ -85,10 +85,12 @@ export default class VideoFeed extends React.Component<IProps, IState> {
if (oldFeed) { if (oldFeed) {
this.props.feed.removeListener(CallFeedEvent.NewStream, this.onNewStream); this.props.feed.removeListener(CallFeedEvent.NewStream, this.onNewStream);
this.props.feed.removeListener(CallFeedEvent.MuteStateChanged, this.onMuteStateChanged);
this.stopMedia(); this.stopMedia();
} }
if (newFeed) { if (newFeed) {
this.props.feed.addListener(CallFeedEvent.NewStream, this.onNewStream); this.props.feed.addListener(CallFeedEvent.NewStream, this.onNewStream);
this.props.feed.addListener(CallFeedEvent.MuteStateChanged, this.onMuteStateChanged);
this.playMedia(); this.playMedia();
} }
} }
@ -137,6 +139,14 @@ export default class VideoFeed extends React.Component<IProps, IState> {
this.playMedia(); this.playMedia();
}; };
private onMuteStateChanged = () => {
this.setState({
audioMuted: this.props.feed.isAudioMuted(),
videoMuted: this.props.feed.isVideoMuted(),
});
this.playMedia();
};
private onResize = (e) => { private onResize = (e) => {
if (this.props.onResize && !this.props.feed.isLocal()) { if (this.props.onResize && !this.props.feed.isLocal()) {
this.props.onResize(e); this.props.onResize(e);