mirror of
https://github.com/suitenumerique/meet.git
synced 2026-08-06 08:57:46 +00:00
040df0e15a
When joining a meeting that already has many participants, new participants are now muted by default. This is an empirical change, not directly requested by users but informed by user experience: a lot of people joining large meetings arrive with their microphone and/or camera open, which can be painful for the host, who otherwise has to mute everyone or ask everyone to mute. Many of these participants are inattentive but still noisy. If you are joining a room that is already at a certain size, you are probably not the one expected to speak; presenters typically join among the very first participants.
76 lines
1.9 KiB
TypeScript
76 lines
1.9 KiB
TypeScript
import { toastQueue } from './components/ToastProvider'
|
|
import { NotificationType } from './NotificationType'
|
|
import { NotificationDuration } from './NotificationDuration'
|
|
import type { Participant } from 'livekit-client'
|
|
import type { NotificationPayload } from './NotificationPayload'
|
|
import type { RecordingMode } from '@/features/recording'
|
|
|
|
export const notifyAutoMutedOnJoin = () => {
|
|
toastQueue.add(
|
|
{
|
|
type: NotificationType.AutoMuteLargeRoom,
|
|
},
|
|
{ timeout: NotificationDuration.ALERT }
|
|
)
|
|
}
|
|
|
|
export const showLowerHandToast = (
|
|
participant: Participant,
|
|
onClose: () => void
|
|
) => {
|
|
toastQueue.add(
|
|
{
|
|
participant,
|
|
type: NotificationType.LowerHand,
|
|
},
|
|
{
|
|
timeout: NotificationDuration.LOWER_HAND,
|
|
onClose,
|
|
}
|
|
)
|
|
}
|
|
|
|
export const closeLowerHandToasts = () => {
|
|
toastQueue.visibleToasts.forEach((toast) => {
|
|
if (toast.content.type === NotificationType.LowerHand) {
|
|
toastQueue.close(toast.key)
|
|
}
|
|
})
|
|
}
|
|
|
|
export const decodeNotificationDataReceived = (
|
|
payload: Uint8Array
|
|
): NotificationPayload | undefined => {
|
|
if (!payload || !(payload instanceof Uint8Array)) {
|
|
throw new Error('Invalid payload: expected Uint8Array')
|
|
}
|
|
try {
|
|
const decoder = new TextDecoder()
|
|
const jsonString = decoder.decode(payload)
|
|
if (!jsonString || typeof jsonString !== 'string') {
|
|
throw new Error('Invalid decoded content')
|
|
}
|
|
// Parse with additional validation if needed
|
|
const parsed = JSON.parse(jsonString)
|
|
return parsed as NotificationPayload
|
|
} catch (error) {
|
|
// Handle errors appropriately for your application
|
|
console.error('Failed to decode notification payload:', error)
|
|
return
|
|
}
|
|
}
|
|
|
|
export const notifyRecordingSaveInProgress = (
|
|
mode: RecordingMode,
|
|
participant: Participant
|
|
) => {
|
|
toastQueue.add(
|
|
{
|
|
participant,
|
|
mode,
|
|
type: NotificationType.RecordingSaving,
|
|
},
|
|
{ timeout: NotificationDuration.RECORDING_SAVING }
|
|
)
|
|
}
|