mirror of
https://github.com/element-hq/element-web.git
synced 2024-12-16 05:41:31 +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,
|
||||
showMoreMenu: false,
|
||||
showDialpad: false,
|
||||
feeds: this.props.call.getFeeds(),
|
||||
feeds: this.sortFeeds(this.props.call.getFeeds()),
|
||||
}
|
||||
|
||||
this.updateCallListeners(null, this.props.call);
|
||||
|
@ -203,14 +203,7 @@ export default class CallView extends React.Component<IProps, IState> {
|
|||
};
|
||||
|
||||
private onFeedsChanged = (newFeeds: Array<CallFeed>) => {
|
||||
// Sort the feeds so that screensharing and remote feeds have priority
|
||||
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});
|
||||
this.setState({feeds: this.sortFeeds(newFeeds)});
|
||||
};
|
||||
|
||||
private onCallLocalHoldUnhold = () => {
|
||||
|
@ -253,6 +246,15 @@ export default class CallView extends React.Component<IProps, IState> {
|
|||
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() {
|
||||
if (this.state.showMoreMenu || this.state.showDialpad) return;
|
||||
|
||||
|
|
Loading…
Reference in a new issue