UNPKG

eye-analysis

Version:

Eye Analysis - Browser-based eye tracking and screen recording library for research and experiments

82 lines 3.86 kB
import { type DownloadSessionOptions } from "./recorder/export"; import type { ExperimentConfig, GazePoint, GazePointInput, QualityMetrics, RecorderState, RecordingConfig, RecordingMode, SessionConfig, SessionEvent, SessionInfo } from "./recorder/types"; import type { TrackingAdaptor } from "./tracking/types"; export type GazeDataCallback = (gazePoint: GazePoint) => void; export type SessionEventCallback = (event: SessionEvent) => void; /** * Initialize the experiment system with tracking adaptor */ export declare const initialize: (config?: { trackingAdaptor?: TrackingAdaptor; onlyCurrentTabAvailable?: boolean; }) => Promise<void>; /** * Create a new experiment session */ export declare const createSession: (config: ExperimentConfig) => Promise<string>; /** * Start experiment recording (tracking adaptors should already be connected) * If no session exists, creates a default session automatically */ export declare const startRecording: (config?: ExperimentConfig) => Promise<string>; /** * Stop experiment recording and end session */ export declare const stopRecording: () => Promise<{ sessionId: string; sessionInfo: SessionInfo | null; }>; /** * Add experiment event (enhanced with callbacks) */ export declare const addSessionEvent: (type: string, data?: Record<string, unknown>) => Promise<void>; /** * Set session event callback */ export declare const onSessionEvent: (callback: SessionEventCallback) => void; /** * Subscribe to gaze data */ export declare const onGaze: (callback: (gaze: GazePoint) => void) => void; /** * Subscribe to experiment state changes */ export declare const onStateChanged: (callback: (state: RecorderState) => void) => (() => void); /** * Subscribe to state changes (alias for onStateChanged) */ export { subscribe } from "./recorder/state"; /** * Add event (alias for addSessionEvent) */ export declare const addEvent: (type: string, data?: Record<string, unknown>) => Promise<void>; /** * Get current experiment state */ export declare const getCurrentState: () => RecorderState; /** * Get current experiment session */ export declare const getCurrentSession: () => SessionInfo | null; /** * Check if experiment is currently recording */ export declare const isRecording: () => boolean; /** * Get current recording stream */ export declare const getRecordingStream: () => MediaStream | null; /** * Re-export DownloadSessionOptions type */ export type { DownloadSessionOptions } from "./recorder/export"; /** * Download session data with flexible options */ export declare const downloadSession: (sessionId?: string, options?: DownloadSessionOptions) => Promise<void>; export { addEvent as coreAddEvent, createSession as coreCreateSession, initialize as coreInitialize, startRecording as coreStartRecording, stopRecording as coreStopRecording, isRecording as getCoreRecording, getCurrentSession as getCoreSession, getCurrentState as getCoreState, getRecordingStream as getCoreRecordingStream, } from "./recorder/core"; export { downloadSession as coreDownloadSession, exportExperimentDataset, gazeDataToCSV, eventsToCSV, createMetadataJSON, downloadFile, createSessionSummaryText, type DownloadSessionOptions as CoreDownloadSessionOptions, } from "./recorder/export"; export { subscribe as coreSubscribe, dispatch as coreDispatch, getState as getCoreRecorderState, } from "./recorder/state"; export { initializeStorage, saveGazeData, saveEvent, saveVideoChunk, getSessionData, getAllSessions, deleteSession, resetDatabase, saveSession, getSession, getVideoChunkData, getStorageUsage, cleanupOldVideoChunks, autoCleanupStorage, } from "./recorder/storage"; export type { SessionConfig, RecordingConfig, RecordingMode, SessionInfo, SessionEvent, GazePoint, GazePointInput, RecorderState, ExperimentConfig, QualityMetrics, }; //# sourceMappingURL=experiment.d.ts.map