mirror of
https://github.com/vector-im/element-call.git
synced 2024-11-15 00:04:59 +08:00
Merge pull request #2528 from robintown/remote-spotlight
More strongly prefer putting a remote speaker in the spotlight
This commit is contained in:
commit
f89342713a
@ -414,19 +414,23 @@ export class CallViewModel extends ViewModel {
|
||||
),
|
||||
),
|
||||
scan<(readonly [UserMedia, boolean])[], UserMedia, null>(
|
||||
(prev, mediaItems) =>
|
||||
(prev, mediaItems) => {
|
||||
const stickyPrev = prev === null || prev.vm.local ? null : prev;
|
||||
// Decide who to spotlight:
|
||||
// If the previous speaker (not the local user) is still speaking,
|
||||
// stick with them rather than switching eagerly to someone else
|
||||
(prev === null || prev.vm.local
|
||||
? null
|
||||
: mediaItems.find(([m, s]) => m === prev && s)?.[0]) ??
|
||||
// Otherwise, select any remote user who is speaking
|
||||
mediaItems.find(([m, s]) => !m.vm.local && s)?.[0] ??
|
||||
// Otherwise, stick with the person who was last speaking
|
||||
prev ??
|
||||
// Otherwise, spotlight the local user
|
||||
mediaItems.find(([m]) => m.vm.local)![0],
|
||||
return (
|
||||
mediaItems.find(([m, s]) => m === stickyPrev && s)?.[0] ??
|
||||
// Otherwise, select any remote user who is speaking
|
||||
mediaItems.find(([m, s]) => !m.vm.local && s)?.[0] ??
|
||||
// Otherwise, stick with the person who was last speaking
|
||||
stickyPrev ??
|
||||
// Otherwise, spotlight an arbitrary remote user
|
||||
mediaItems.find(([m]) => !m.vm.local)?.[0] ??
|
||||
// Otherwise, spotlight the local user
|
||||
mediaItems.find(([m]) => m.vm.local)![0]
|
||||
);
|
||||
},
|
||||
null,
|
||||
),
|
||||
distinctUntilChanged(),
|
||||
|
Loading…
Reference in New Issue
Block a user