UNPKG

@airsurfer09/web-handsfree

Version:

A React package for integrating Convai's AI-powered voice assistants with LiveKit for real-time audio/video conversations

37 lines 1.03 kB
import { Room } from "livekit-client"; /** * Hook for toggling TTS (Text-to-Speech) generation in Convai. * * Sends a tts-toggle message to control whether the bot generates audio. * This is more efficient than muting audio after generation, as it prevents * audio generation at the source. * * @param {Room} room - LiveKit room instance * @returns {Object} Object containing toggleTts function * * @example * ```tsx * function AudioControlComponent() { * const { toggleTts } = useTtsToggle(room); * * const handleMute = () => { * toggleTts(false); // Disable TTS generation * }; * * const handleUnmute = () => { * toggleTts(true); // Enable TTS generation * }; * * return ( * <div> * <button onClick={handleMute}>Mute TTS</button> * <button onClick={handleUnmute}>Unmute TTS</button> * </div> * ); * } * ``` */ export declare const useTtsToggle: (room: Room) => { toggleTts: (enabled: boolean) => void; }; //# sourceMappingURL=useTtsToggle.d.ts.map