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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user