Update environment configurations for local development, add socket.io and uuid dependencies, and refactor session management to support guest IDs for unauthorized users. Enhance ParticipantsPopup and UserCamera components to handle local media permissions and improve user session handling. Update optional authentication middleware to manage guest IDs and session validation.

This commit is contained in:
2025-10-28 16:58:38 +05:00
parent 2378ed1ff4
commit 4b81b22a1d
17 changed files with 375 additions and 203 deletions
+8 -10
View File
@@ -28,7 +28,7 @@ export function useVoiceActivity(
const [audioLevel, setAudioLevel] = useState(0);
const audioContextRef = useRef<AudioContext | null>(null);
const analyserRef = useRef<AnalyserNode | null>(null);
const animationFrameRef = useRef<number | null>(null);
const intervalRef = useRef<NodeJS.Timeout | null>(null);
const lastSpeakingTimeRef = useRef<number>(0);
const speakingTimeoutRef = useRef<NodeJS.Timeout | null>(null);
@@ -132,7 +132,7 @@ export function useVoiceActivity(
}
}
// Логируем каждые 30 кадров (~500ms при 60fps)
// Логируем каждые 30 вызовов (~500ms при частоте 60 Hz)
frameCount++;
if (frameCount % 30 === 0) {
console.log(
@@ -145,13 +145,11 @@ export function useVoiceActivity(
}`
);
}
// Запланировать следующую проверку
animationFrameRef.current = requestAnimationFrame(checkVoiceActivity);
};
// Запускаем проверку
checkVoiceActivity();
// Запускаем проверку с интервалом ~16ms (приблизительно 60 FPS)
// setInterval работает стабильно даже когда окно неактивно
intervalRef.current = setInterval(checkVoiceActivity, 16);
console.log(
`[useVoiceActivity] Started voice activity detection - Threshold: ${threshold}, FFT: ${fftSize}, Smoothing: ${smoothingTimeConstant}, Debounce: ${debounceTime}ms`
@@ -167,9 +165,9 @@ export function useVoiceActivity(
// Cleanup
return () => {
if (animationFrameRef.current !== null) {
cancelAnimationFrame(animationFrameRef.current);
animationFrameRef.current = null;
if (intervalRef.current !== null) {
clearInterval(intervalRef.current);
intervalRef.current = null;
}
if (speakingTimeoutRef.current !== null) {