Skip to content

Commit

Permalink
refactor(CallScreen): Sort chat users by video enabled status
Browse files Browse the repository at this point in the history
  • Loading branch information
lgmarchi committed Oct 21, 2024
1 parent 08f230e commit 55cdb4c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lib/components/calling/CallScreen.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,11 @@
{/if}
</div>

{#each chat.users as user (user)}
{#each chat.users.sort((a, b) => {
const aVideoEnabled = $remoteStreams[a]?.user?.videoEnabled ? 1 : 0
const bVideoEnabled = $remoteStreams[b]?.user?.videoEnabled ? 1 : 0
return bVideoEnabled - aVideoEnabled
}) as user (user)}
{#if user === get(Store.state.user).key && !userCallOptions.video.enabled}
<Participant participant={$userCache[user]} hasVideo={$userCache[user].media.is_streaming_video} isMuted={muted} isDeafened={userCallOptions.audio.deafened} isTalking={$userCache[user].media.is_playing_audio} />
{:else if $userCache[user] && $userCache[user].key !== get(Store.state.user).key && !$remoteStreams[user]}
Expand Down

0 comments on commit 55cdb4c

Please sign in to comment.