@aituber-onair/core
Version:
Core library for AITuber OnAir providing voice synthesis and chat processing
70 lines (69 loc) • 2.02 kB
TypeScript
import { EventEmitter } from '../../core/EventEmitter';
import { YouTubeService, YouTubeServiceOptions, YouTubeComment } from './YouTubeService';
/**
* YouTube Data API implementation using YouTube service
*/
export declare class YouTubeDataApiService extends EventEmitter implements YouTubeService {
private options;
private isWatchingLive;
private watchingIntervalId;
private nextPageToken;
private currentLiveId;
/**
* Constructor
* @param options Service settings options
*/
constructor(options: YouTubeServiceOptions);
/**
* Start watching live comments
* @param liveId Live ID
*/
startWatching(liveId: string): Promise<void>;
/**
* Stop watching live comments
*/
stopWatching(): void;
/**
* Return whether currently fetching
*/
isWatching(): boolean;
/**
* Set comment fetch interval
* @param interval Interval in milliseconds
*/
setFetchInterval(interval: number): void;
/**
* Set comment selection strategy
* @param strategy Selection strategy ('random' or 'latest')
*/
setSelectionStrategy(strategy: 'random' | 'latest'): void;
/**
* Fetch latest comments (for manual retrieval)
* @param liveId Live ID
* @returns Comments array
*/
fetchLatestComments(liveId: string): Promise<YouTubeComment[]>;
/**
* Subscribe to comment reception event
* @param callback Callback when comment is received
*/
onComment(callback: (comment: YouTubeComment) => void): void;
/**
* Get live chat ID
* @param liveId Live ID
* @returns Live chat ID
*/
private getLiveChatId;
/**
* Fetch live comments
* @param liveChatId Live chat ID
* @param usePageToken Whether to use page token
* @returns Comments array
*/
private retrieveLiveComments;
/**
* Fetch and process comments
* @param liveChatId Live chat ID
*/
private fetchAndProcessComments;
}