mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-18 22:58:18 +08:00
Improve and fix sorting
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
parent
430808ae2e
commit
69b0425c10
@ -203,7 +203,14 @@ export default class CallView extends React.Component<IProps, IState> {
|
||||
};
|
||||
|
||||
private onFeedsChanged = (newFeeds: Array<CallFeed>) => {
|
||||
this.setState({feeds: newFeeds});
|
||||
// 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});
|
||||
};
|
||||
|
||||
private onCallLocalHoldUnhold = () => {
|
||||
@ -396,13 +403,7 @@ export default class CallView extends React.Component<IProps, IState> {
|
||||
}
|
||||
|
||||
private renderFeeds(feeds: Array<CallFeed>, offset = 0) {
|
||||
const sortedFeeds = [...feeds].sort((a, b) => {
|
||||
if (b.purpose === SDPStreamMetadataPurpose.Screenshare && !b.isLocal()) return 1;
|
||||
if (a.isLocal() && !b.isLocal()) return 1;
|
||||
return 0;
|
||||
});
|
||||
|
||||
return sortedFeeds.map((feed, i) => {
|
||||
return feeds.map((feed, i) => {
|
||||
i += offset;
|
||||
// TODO: Later the CallView should probably be reworked to support
|
||||
// any number of feeds but now we can't render more than 4 feeds
|
||||
|
Loading…
Reference in New Issue
Block a user