UNPKG

@airsurfer09/web-handsfree

Version:

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

45 lines 1.64 kB
import { Room } from "livekit-client"; export interface ScreenShareControls { isScreenShareEnabled: boolean; isScreenShareActive: boolean; enableScreenShare: () => Promise<void>; disableScreenShare: () => Promise<void>; toggleScreenShare: () => Promise<void>; enableScreenShareWithAudio: () => Promise<void>; getScreenShareTracks: () => Promise<any[]>; } /** * Hook for managing screen sharing controls in LiveKit. * * Provides methods to enable/disable screen sharing, manage screen share state, * and handle screen sharing with audio support. * * Features: * - Includes current tab in screen share options (selfBrowserSurface: "include") * - Supports surface switching during screen share * - Supports system audio capture * * Note: By default, browsers exclude the current tab from screen share to prevent * infinite recursion ("hall of mirrors" effect). This hook enables it by setting * selfBrowserSurface: "include", but be aware this may cause visual feedback loops. * * @param {Room | null} room - LiveKit room instance * @returns {ScreenShareControls} Object containing screen share control methods and state * * @example * ```tsx * function ScreenShareControls() { * const screenShareControls = useScreenShare(room); * * return ( * <div> * <button onClick={screenShareControls.toggleScreenShare}> * {screenShareControls.isScreenShareEnabled ? 'Stop Sharing' : 'Share Screen'} * </button> * </div> * ); * } * ``` */ export declare const useScreenShare: (room: Room | null) => ScreenShareControls; //# sourceMappingURL=useScreenShare.d.ts.map