Keep rendering AudioFeeds on hold

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner 2021-04-28 11:29:05 +02:00
parent 4c58a95046
commit e5b61f0632
No known key found for this signature in database
GPG key ID: 9760693FDD98A790

View file

@ -25,7 +25,6 @@ interface IProps {
interface IState { interface IState {
feeds: Array<CallFeed>; feeds: Array<CallFeed>;
onHold: boolean;
} }
export default class AudioFeedArrayForCall extends React.Component<IProps, IState> { export default class AudioFeedArrayForCall extends React.Component<IProps, IState> {
@ -34,18 +33,15 @@ export default class AudioFeedArrayForCall extends React.Component<IProps, IStat
this.state = { this.state = {
feeds: [], feeds: [],
onHold: false,
}; };
} }
componentDidMount() { componentDidMount() {
this.props.call.addListener(CallEvent.FeedsChanged, this.onFeedsChanged); this.props.call.addListener(CallEvent.FeedsChanged, this.onFeedsChanged);
this.props.call.addListener(CallEvent.HoldUnhold, this.onHoldUnhold);
} }
componentWillUnmount() { componentWillUnmount() {
this.props.call.removeListener(CallEvent.FeedsChanged, this.onFeedsChanged); this.props.call.removeListener(CallEvent.FeedsChanged, this.onFeedsChanged);
this.props.call.removeListener(CallEvent.HoldUnhold, this.onHoldUnhold);
} }
onFeedsChanged = () => { onFeedsChanged = () => {
@ -54,20 +50,11 @@ export default class AudioFeedArrayForCall extends React.Component<IProps, IStat
}); });
} }
onHoldUnhold = (onHold: boolean) => {
this.setState({onHold: onHold});
}
render() { render() {
// If we are onHold don't render any audio elements return this.state.feeds.map((feed, i) => {
if (this.state.onHold) return null;
const feeds = this.state.feeds.map((feed, i) => {
return ( return (
<AudioFeed feed={feed} key={i} /> <AudioFeed feed={feed} key={i} />
); );
}); });
return feeds;
} }
} }