fix(voice): keep LiveKit TTS tracks alive

This commit is contained in:
Yahya Alhinai
2026-06-28 07:20:54 +00:00
parent 46d277d203
commit c4c65f8802
91 changed files with 16863 additions and 21 deletions
@@ -0,0 +1,27 @@
import * as React from 'react';
import { LogLevel, setLogLevel } from 'livekit-client';
import { useRoomContext } from '@livekit/components-react';
export const useDebugMode = (options: { logLevel?: LogLevel; enabled?: boolean } = {}) => {
const room = useRoomContext();
const logLevel = options.logLevel ?? 'debug';
const enabled = options.enabled ?? true;
React.useEffect(() => {
if (!enabled) {
setLogLevel('silent');
return;
}
setLogLevel(logLevel ?? 'debug');
// @ts-expect-error this is a global variable
window.__lk_room = room;
return () => {
// @ts-expect-error this is a global variable
window.__lk_room = undefined;
setLogLevel('silent');
};
}, [room, enabled, logLevel]);
};