mirror of
https://github.com/element-hq/element-web.git
synced 2024-12-16 20:51:44 +03:00
Always sort feeds
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
parent
228b2ccf2d
commit
90f4ad7a83
1 changed files with 11 additions and 9 deletions
|
@ -128,7 +128,7 @@ export default class CallView extends React.Component<IProps, IState> {
|
||||||
controlsVisible: true,
|
controlsVisible: true,
|
||||||
showMoreMenu: false,
|
showMoreMenu: false,
|
||||||
showDialpad: false,
|
showDialpad: false,
|
||||||
feeds: this.props.call.getFeeds(),
|
feeds: this.sortFeeds(this.props.call.getFeeds()),
|
||||||
}
|
}
|
||||||
|
|
||||||
this.updateCallListeners(null, this.props.call);
|
this.updateCallListeners(null, this.props.call);
|
||||||
|
@ -203,14 +203,7 @@ export default class CallView extends React.Component<IProps, IState> {
|
||||||
};
|
};
|
||||||
|
|
||||||
private onFeedsChanged = (newFeeds: Array<CallFeed>) => {
|
private onFeedsChanged = (newFeeds: Array<CallFeed>) => {
|
||||||
// Sort the feeds so that screensharing and remote feeds have priority
|
this.setState({feeds: this.sortFeeds(newFeeds)});
|
||||||
const sortedFeeds = [...newFeeds].sort((a, b) => {
|
|
||||||
if (b.purpose === SDPStreamMetadataPurpose.Screenshare && !b.isLocal()) return 1;
|
|
||||||
if (a.isLocal() && !b.isLocal()) return 1;
|
|
||||||
return -1;
|
|
||||||
});
|
|
||||||
|
|
||||||
this.setState({feeds: sortedFeeds});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
private onCallLocalHoldUnhold = () => {
|
private onCallLocalHoldUnhold = () => {
|
||||||
|
@ -253,6 +246,15 @@ export default class CallView extends React.Component<IProps, IState> {
|
||||||
this.showControls();
|
this.showControls();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private sortFeeds(feeds: Array<CallFeed>) {
|
||||||
|
// Sort the feeds so that screensharing and remote feeds have priority
|
||||||
|
return [...feeds].sort((a, b) => {
|
||||||
|
if (b.purpose === SDPStreamMetadataPurpose.Screenshare && !b.isLocal()) return 1;
|
||||||
|
if (a.isLocal() && !b.isLocal()) return 1;
|
||||||
|
return -1;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private showControls() {
|
private showControls() {
|
||||||
if (this.state.showMoreMenu || this.state.showDialpad) return;
|
if (this.state.showMoreMenu || this.state.showDialpad) return;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue