Keep rendering AudioFeeds on hold
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
parent
4c58a95046
commit
e5b61f0632
1 changed files with 1 additions and 14 deletions
|
@ -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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue