Add a right around user avatar when speaking

This commit is contained in:
mplorentz
2026-03-03 16:50:54 -05:00
parent b4c68b66eb
commit b14e592ba7
2 changed files with 18 additions and 2 deletions
+10 -2
View File
@@ -1,4 +1,5 @@
<script lang="ts">
import cx from "classnames"
import {loadProfile, displayProfileByPubkey} from "@welshman/app"
import Volume from "@assets/icons/volume.svg?dataurl"
import Icon from "@lib/components/Icon.svelte"
@@ -12,6 +13,7 @@
joinVoiceRoom,
leaveVoiceRoom,
currentVoiceSession,
speakingPubkeys,
} from "@app/voice"
interface Props {
@@ -71,10 +73,16 @@
<RoomName {url} {h} />
</SecondaryNavItem>
{#if $participants.length > 0}
<div class="flex flex-col gap-1 pb-1 pl-10">
<div class="mt-2 flex flex-col gap-1 pb-1 pl-10">
{#each $participants as pk (pk)}
<div class="flex items-center gap-2">
<ProfileCircle pubkey={pk} size={5} class="h-5 w-5" />
<div
class={cx(
"inline-flex shrink-0 items-center justify-center rounded-full transition-shadow",
isActive && $speakingPubkeys.has(pk) && "ring-2 ring-success",
)}>
<ProfileCircle pubkey={pk} size={5} class="h-5 w-5" />
</div>
<span class="ellipsize text-xs opacity-70">
{displayProfileByPubkey(pk)}
</span>
+8
View File
@@ -46,6 +46,8 @@ export type VoiceSession = {
export const currentVoiceSession = writable<VoiceSession | undefined>(undefined)
export const speakingPubkeys = writable<Set<string>>(new Set())
const fetchLivekitToken = async (
url: string,
groupId: string,
@@ -157,6 +159,7 @@ export const joinVoiceRoom = async (
})
room.on(RoomEvent.Disconnected, (reason?: DisconnectReason) => {
speakingPubkeys.set(new Set())
currentVoiceSession.set(undefined)
stopPresenceHeartbeat()
if (reason !== undefined && reason !== DisconnectReason.CLIENT_INITIATED) {
@@ -181,6 +184,10 @@ export const joinVoiceRoom = async (
track.detach().forEach(el => el.remove())
})
room.on(RoomEvent.ActiveSpeakersChanged, participants => {
speakingPubkeys.set(new Set(participants.map(p => p.identity)))
})
const onAbort = () => {
room.disconnect()
}
@@ -225,6 +232,7 @@ export const leaveVoiceRoom = async () => {
const session = get(currentVoiceSession)
if (!session) return
speakingPubkeys.set(new Set())
stopPresenceHeartbeat()
session.room.disconnect()
deletePresence(session.url)