export type IPlayerDataProvider = IFeedPlayerDataProvider | IChunksPlayerDataProvider; export interface IFeedPlayerDataProvider { kind: 'feed'; initialData: { prefetchedItems: T[]; startIndex: number; startMediaIndex?: number; }; loadMore: () => Promise; onEndReached?: () => void; } export interface IChunksPlayerDataProvider { kind: 'chunks'; initialData: { prefetchedChunks: TChunk[]; startItemIndex?: number; }; loadMoreChunks: () => Promise; loadChunkItems: (chunkId: string, continuationToken: string | null | undefined) => Promise<{ items: TItem[]; continuationToken: string | null; }>; onEndReached?: () => void; } export type IPlayerBuffer = IFeedPlayerBuffer | IChunksPlayerBuffer; export interface IPlayerBufferBase { readonly kind: 'feed' | 'chunks'; readonly current: TExtended | null; readonly loaded: TExtended[]; readonly currentIndex: number; readonly canLoadNext: boolean; readonly canLoadPrevious: boolean; readonly navigationDisabled: boolean; readonly animationDuration: number; loadNext: () => void; loadPrevious: () => void; ensureWarmedUp: () => Promise; tryActivateItemById: (id: string) => boolean; removeItemById: (id: string) => void; } type TExtended = T & { mediaIndex?: number; }; export interface IFeedPlayerBuffer extends IPlayerBufferBase { readonly kind: 'feed'; /** Drops the buffered feed and loads it again from the start. */ reset: () => void; } export interface IChunksPlayerBuffer extends IPlayerBufferBase { readonly kind: 'chunks'; } export type WithId = { id: string; }; export {};