@xhub-reel/feed 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +130 -27
- package/dist/index.d.ts +130 -27
- package/dist/index.js +469 -162
- package/dist/index.mjs +463 -163
- package/package.json +5 -3
package/dist/index.d.mts
CHANGED
|
@@ -2,6 +2,8 @@ import * as react from 'react';
|
|
|
2
2
|
import { CSSProperties, ReactNode, HTMLAttributes, RefObject } from 'react';
|
|
3
3
|
import { Video, XHubReelConfig, VideoFetchParams } from '@xhub-reel/core';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
|
+
import { VideoEnginePoolOptions, PlatformConfig, EngineSlot, SlotState, VideoEnginePool } from '@xhub-reel/player-engine';
|
|
6
|
+
export { EngineSlot, PlatformConfig, SlotState, VideoEnginePoolOptions } from '@xhub-reel/player-engine';
|
|
5
7
|
import { useQueryClient } from '@tanstack/react-query';
|
|
6
8
|
export { UsePreloadOptions, UsePreloadReturn, usePreload } from '@xhub-reel/player';
|
|
7
9
|
|
|
@@ -160,6 +162,8 @@ declare const VideoFeedItem: react.ForwardRefExoticComponent<VideoFeedItemProps
|
|
|
160
162
|
interface VideoFeedItemPlayerProps extends HTMLAttributes<HTMLDivElement> {
|
|
161
163
|
/** Custom placeholder element */
|
|
162
164
|
placeholder?: React.ReactNode;
|
|
165
|
+
/** Force using pool (if available) or native video */
|
|
166
|
+
forceNative?: boolean;
|
|
163
167
|
}
|
|
164
168
|
declare const VideoFeedItemPlayer: react.ForwardRefExoticComponent<VideoFeedItemPlayerProps & react.RefAttributes<HTMLVideoElement>>;
|
|
165
169
|
|
|
@@ -176,6 +180,18 @@ declare const VideoFeedItemActions: react.ForwardRefExoticComponent<VideoFeedIte
|
|
|
176
180
|
interface VideoFeedItemTimelineProps extends HTMLAttributes<HTMLDivElement> {
|
|
177
181
|
/** Override expanded state */
|
|
178
182
|
expanded?: boolean;
|
|
183
|
+
/** Enable seek preview popup while dragging (default: false) */
|
|
184
|
+
showPreview?: boolean;
|
|
185
|
+
/**
|
|
186
|
+
* Get thumbnail URL for a specific time (seconds)
|
|
187
|
+
* If not provided, only time indicator will be shown during seek
|
|
188
|
+
* @example (time) => `/api/thumbnails/${videoId}?t=${Math.floor(time)}`
|
|
189
|
+
*/
|
|
190
|
+
getThumbnailUrl?: (time: number) => string | undefined;
|
|
191
|
+
/** Preview thumbnail width (default: 120) */
|
|
192
|
+
previewWidth?: number;
|
|
193
|
+
/** Preview thumbnail height (default: 68) */
|
|
194
|
+
previewHeight?: number;
|
|
179
195
|
}
|
|
180
196
|
declare const VideoFeedItemTimeline: react.ForwardRefExoticComponent<VideoFeedItemTimelineProps & react.RefAttributes<HTMLDivElement>>;
|
|
181
197
|
|
|
@@ -192,6 +208,8 @@ declare const VideoFeedItemOverlay: react.ForwardRefExoticComponent<VideoFeedIte
|
|
|
192
208
|
interface VideoFeedItemContextValue {
|
|
193
209
|
video: Video;
|
|
194
210
|
isActive: boolean;
|
|
211
|
+
/** Preload priority level */
|
|
212
|
+
priority: 'high' | 'medium' | 'low' | 'metadata' | 'none';
|
|
195
213
|
shouldRenderVideo: boolean;
|
|
196
214
|
preload: '' | 'none' | 'metadata' | 'auto';
|
|
197
215
|
/** Video has been preloaded and first frame is ready */
|
|
@@ -238,6 +256,78 @@ interface VideoOverlayProps {
|
|
|
238
256
|
}
|
|
239
257
|
declare function VideoOverlay({ video, timelineExpanded, style, className, }: VideoOverlayProps): react_jsx_runtime.JSX.Element;
|
|
240
258
|
|
|
259
|
+
interface VideoEnginePoolProviderProps {
|
|
260
|
+
children: ReactNode;
|
|
261
|
+
/** Pool configuration options */
|
|
262
|
+
options?: VideoEnginePoolOptions;
|
|
263
|
+
/** Platform config overrides */
|
|
264
|
+
config?: Partial<PlatformConfig>;
|
|
265
|
+
/** Force HLS.js over native (recommended for WebViews) */
|
|
266
|
+
forceHLSJS?: boolean;
|
|
267
|
+
/** Callback when slot state changes */
|
|
268
|
+
onSlotStateChange?: (slot: EngineSlot, prevState: SlotState) => void;
|
|
269
|
+
/** Callback when error occurs */
|
|
270
|
+
onError?: (slot: EngineSlot, error: Error) => void;
|
|
271
|
+
/** Callback when first frame is ready */
|
|
272
|
+
onFirstFrameReady?: (slot: EngineSlot) => void;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Provider component that creates and manages a VideoEnginePool instance.
|
|
276
|
+
* Wrap your feed or app with this provider to enable pooled video playback.
|
|
277
|
+
*/
|
|
278
|
+
declare function VideoEnginePoolProvider({ children, options, config, forceHLSJS, onSlotStateChange, onError, onFirstFrameReady, }: VideoEnginePoolProviderProps): react_jsx_runtime.JSX.Element;
|
|
279
|
+
/**
|
|
280
|
+
* Hook to access the VideoEnginePool instance.
|
|
281
|
+
* Must be used within a VideoEnginePoolProvider.
|
|
282
|
+
* Returns null during SSR or before hydration.
|
|
283
|
+
*/
|
|
284
|
+
declare function useVideoEnginePool(): VideoEnginePool | null;
|
|
285
|
+
/**
|
|
286
|
+
* Hook to check if pool is available (for conditional rendering).
|
|
287
|
+
* Returns null if not in provider context (doesn't throw).
|
|
288
|
+
*/
|
|
289
|
+
declare function useVideoEnginePoolOptional(): VideoEnginePool | null;
|
|
290
|
+
/**
|
|
291
|
+
* Hook to orchestrate the pool based on current feed position.
|
|
292
|
+
* Call this in your VideoFeed component to automatically manage preloading.
|
|
293
|
+
*
|
|
294
|
+
* @param currentIndex - Current video index in feed
|
|
295
|
+
* @param videos - Array of video data
|
|
296
|
+
* @param enabled - Whether orchestration is enabled (default: true)
|
|
297
|
+
*/
|
|
298
|
+
declare function usePoolOrchestration(currentIndex: number, videos: Video[], enabled?: boolean): void;
|
|
299
|
+
/**
|
|
300
|
+
* Hook for a single video slot management.
|
|
301
|
+
* Use this in individual video item components.
|
|
302
|
+
*
|
|
303
|
+
* @param video - Video data
|
|
304
|
+
* @param isActive - Whether this video is currently active
|
|
305
|
+
*/
|
|
306
|
+
declare function usePooledVideo(video: Video, isActive: boolean): {
|
|
307
|
+
element: HTMLVideoElement | null;
|
|
308
|
+
isReady: boolean;
|
|
309
|
+
state: SlotState | null;
|
|
310
|
+
containerRef: (node: HTMLDivElement | null) => void;
|
|
311
|
+
};
|
|
312
|
+
/**
|
|
313
|
+
* Hook to get pool statistics for debugging/monitoring.
|
|
314
|
+
*/
|
|
315
|
+
declare function usePoolStats(): {
|
|
316
|
+
totalSlots: number;
|
|
317
|
+
activeSlots: number;
|
|
318
|
+
preloadedSlots: number;
|
|
319
|
+
loadingSlots: number;
|
|
320
|
+
elementPoolSize: number;
|
|
321
|
+
} | null;
|
|
322
|
+
/**
|
|
323
|
+
* Hook to manually trigger memory reduction.
|
|
324
|
+
* Useful when you detect memory pressure.
|
|
325
|
+
*/
|
|
326
|
+
declare function usePoolMemoryControl(): {
|
|
327
|
+
reduceMemory: () => void;
|
|
328
|
+
pauseAll: () => void;
|
|
329
|
+
};
|
|
330
|
+
|
|
241
331
|
interface ConnectedVideoFeedProps extends Omit<VideoFeedProps, 'videos' | 'isLoading' | 'hasMore' | 'onLoadMore'> {
|
|
242
332
|
/**
|
|
243
333
|
* XHubReelConfig for API connection
|
|
@@ -271,6 +361,23 @@ interface ConnectedVideoFeedProps extends Omit<VideoFeedProps, 'videos' | 'isLoa
|
|
|
271
361
|
* @default true
|
|
272
362
|
*/
|
|
273
363
|
initialMuted?: boolean;
|
|
364
|
+
/**
|
|
365
|
+
* Enable Video Engine Pool for instant playback
|
|
366
|
+
* - When `true`: Uses pre-loading and pre-decoding for seamless swipe
|
|
367
|
+
* - When `false`: Uses standard video loading (simpler, less memory)
|
|
368
|
+
* @default true
|
|
369
|
+
*/
|
|
370
|
+
pooling?: boolean;
|
|
371
|
+
/**
|
|
372
|
+
* Pool configuration (only used when pooling=true)
|
|
373
|
+
*/
|
|
374
|
+
poolConfig?: VideoEnginePoolProviderProps['config'];
|
|
375
|
+
/**
|
|
376
|
+
* Force HLS.js over native HLS (only used when pooling=true)
|
|
377
|
+
* Recommended for WebViews (especially iOS) for better preloading control
|
|
378
|
+
* @default auto-detect based on platform
|
|
379
|
+
*/
|
|
380
|
+
forceHLSJS?: boolean;
|
|
274
381
|
/**
|
|
275
382
|
* Called when videos are successfully fetched
|
|
276
383
|
*/
|
|
@@ -294,6 +401,28 @@ interface ConnectedVideoFeedProps extends Omit<VideoFeedProps, 'videos' | 'isLoa
|
|
|
294
401
|
}
|
|
295
402
|
declare const ConnectedVideoFeed: react.ForwardRefExoticComponent<ConnectedVideoFeedProps & react.RefAttributes<VideoFeedRef>>;
|
|
296
403
|
|
|
404
|
+
interface PooledVideoFeedProps extends Omit<VideoFeedProps, 'children'> {
|
|
405
|
+
/** Pool configuration */
|
|
406
|
+
poolConfig?: VideoEnginePoolProviderProps['config'];
|
|
407
|
+
/** Force HLS.js over native (recommended for WebViews) */
|
|
408
|
+
forceHLSJS?: boolean;
|
|
409
|
+
/** Show timeline control */
|
|
410
|
+
showTimeline?: boolean;
|
|
411
|
+
/** Custom render function for video items */
|
|
412
|
+
renderVideoItem?: (props: {
|
|
413
|
+
video: Video;
|
|
414
|
+
isActive: boolean;
|
|
415
|
+
priority: PreloadPriority;
|
|
416
|
+
}) => React.ReactNode;
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* PooledVideoFeed - VideoFeed with automatic engine pooling
|
|
420
|
+
*
|
|
421
|
+
* This component wraps VideoFeed with VideoEnginePoolProvider for
|
|
422
|
+
* high-performance video preloading and instant playback.
|
|
423
|
+
*/
|
|
424
|
+
declare const PooledVideoFeed: react.ForwardRefExoticComponent<PooledVideoFeedProps & react.RefAttributes<VideoFeedRef>>;
|
|
425
|
+
|
|
297
426
|
/**
|
|
298
427
|
* useVideoVisibility - Track video visibility using IntersectionObserver
|
|
299
428
|
*/
|
|
@@ -453,32 +582,6 @@ declare function useMemoryManager({ videoId, estimatedSizeMB, onShouldDispose, }
|
|
|
453
582
|
*/
|
|
454
583
|
declare function useGlobalMemoryState(): MemoryState;
|
|
455
584
|
|
|
456
|
-
/**
|
|
457
|
-
* useFeedScroll - Scroll management hook with snap behavior
|
|
458
|
-
*/
|
|
459
|
-
|
|
460
|
-
interface UseFeedScrollOptions {
|
|
461
|
-
/** Scroll container ref */
|
|
462
|
-
scrollRef: RefObject<HTMLElement | null>;
|
|
463
|
-
/** Total number of items */
|
|
464
|
-
itemCount: number;
|
|
465
|
-
/** Height of each item (default: viewport height) */
|
|
466
|
-
itemHeight?: number;
|
|
467
|
-
/** Callback when scroll position changes */
|
|
468
|
-
onScrollChange?: (scrollTop: number, velocity: number) => void;
|
|
469
|
-
/** Callback when current index changes */
|
|
470
|
-
onIndexChange?: (index: number) => void;
|
|
471
|
-
}
|
|
472
|
-
interface UseFeedScrollReturn {
|
|
473
|
-
currentIndex: number;
|
|
474
|
-
scrollVelocity: number;
|
|
475
|
-
isScrolling: boolean;
|
|
476
|
-
scrollToIndex: (index: number, smooth?: boolean) => void;
|
|
477
|
-
scrollToNext: () => void;
|
|
478
|
-
scrollToPrev: () => void;
|
|
479
|
-
}
|
|
480
|
-
declare function useFeedScroll({ scrollRef, itemCount, itemHeight, onScrollChange, onIndexChange, }: UseFeedScrollOptions): UseFeedScrollReturn;
|
|
481
|
-
|
|
482
585
|
/**
|
|
483
586
|
* useInfiniteScroll - Hook for infinite scroll loading
|
|
484
587
|
*/
|
|
@@ -661,4 +764,4 @@ interface UseSwipeAnimationReturn {
|
|
|
661
764
|
}
|
|
662
765
|
declare function useSwipeAnimation({ trackRef, transitionDuration, easing, onTransitionEnd, }: UseSwipeAnimationOptions): UseSwipeAnimationReturn;
|
|
663
766
|
|
|
664
|
-
export { ConnectedVideoFeed, type ConnectedVideoFeedProps, type MemoryState,
|
|
767
|
+
export { ConnectedVideoFeed, type ConnectedVideoFeedProps, type MemoryState, PooledVideoFeed, type PooledVideoFeedProps, type PreloadPriority, type UseInfiniteScrollOptions, type UseInfiniteScrollReturn, type UseMemoryManagerOptions, type UseMemoryManagerReturn, type UseSwipeAnimationOptions, type UseSwipeAnimationReturn, type UseVideoActivationOptions, type UseVideoActivationReturn, type UseVideoFeedOptions, type UseVideoFeedReturn, type UseVideoVisibilityOptions, type UseVideoVisibilityReturn, VideoEnginePoolProvider, type VideoEnginePoolProviderProps, VideoFeed, VideoFeedItem, VideoFeedItemActions, type VideoFeedItemActionsProps, type VideoFeedItemContextValue, VideoFeedItemOverlay, type VideoFeedItemOverlayProps, VideoFeedItemPlayer, type VideoFeedItemPlayerProps, type VideoFeedItemProps, VideoFeedItemTimeline, type VideoFeedItemTimelineProps, type VideoFeedProps, type VideoFeedRef, type VideoMemoryEntry, VideoOverlay, type VideoOverlayProps, getPreloadPriority, getPreloadPriorityForFeed, mapPriorityToNumeric, memoryManager, prefetchVideoFeed, useGlobalMemoryState, useInfiniteScroll, useMemoryManager, usePoolMemoryControl, usePoolOrchestration, usePoolStats, usePooledVideo, useSwipeAnimation, useVideoActivation, useVideoEnginePool, useVideoEnginePoolOptional, useVideoFeed, useVideoFeedItemContext, useVideoVisibility };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import * as react from 'react';
|
|
|
2
2
|
import { CSSProperties, ReactNode, HTMLAttributes, RefObject } from 'react';
|
|
3
3
|
import { Video, XHubReelConfig, VideoFetchParams } from '@xhub-reel/core';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
|
+
import { VideoEnginePoolOptions, PlatformConfig, EngineSlot, SlotState, VideoEnginePool } from '@xhub-reel/player-engine';
|
|
6
|
+
export { EngineSlot, PlatformConfig, SlotState, VideoEnginePoolOptions } from '@xhub-reel/player-engine';
|
|
5
7
|
import { useQueryClient } from '@tanstack/react-query';
|
|
6
8
|
export { UsePreloadOptions, UsePreloadReturn, usePreload } from '@xhub-reel/player';
|
|
7
9
|
|
|
@@ -160,6 +162,8 @@ declare const VideoFeedItem: react.ForwardRefExoticComponent<VideoFeedItemProps
|
|
|
160
162
|
interface VideoFeedItemPlayerProps extends HTMLAttributes<HTMLDivElement> {
|
|
161
163
|
/** Custom placeholder element */
|
|
162
164
|
placeholder?: React.ReactNode;
|
|
165
|
+
/** Force using pool (if available) or native video */
|
|
166
|
+
forceNative?: boolean;
|
|
163
167
|
}
|
|
164
168
|
declare const VideoFeedItemPlayer: react.ForwardRefExoticComponent<VideoFeedItemPlayerProps & react.RefAttributes<HTMLVideoElement>>;
|
|
165
169
|
|
|
@@ -176,6 +180,18 @@ declare const VideoFeedItemActions: react.ForwardRefExoticComponent<VideoFeedIte
|
|
|
176
180
|
interface VideoFeedItemTimelineProps extends HTMLAttributes<HTMLDivElement> {
|
|
177
181
|
/** Override expanded state */
|
|
178
182
|
expanded?: boolean;
|
|
183
|
+
/** Enable seek preview popup while dragging (default: false) */
|
|
184
|
+
showPreview?: boolean;
|
|
185
|
+
/**
|
|
186
|
+
* Get thumbnail URL for a specific time (seconds)
|
|
187
|
+
* If not provided, only time indicator will be shown during seek
|
|
188
|
+
* @example (time) => `/api/thumbnails/${videoId}?t=${Math.floor(time)}`
|
|
189
|
+
*/
|
|
190
|
+
getThumbnailUrl?: (time: number) => string | undefined;
|
|
191
|
+
/** Preview thumbnail width (default: 120) */
|
|
192
|
+
previewWidth?: number;
|
|
193
|
+
/** Preview thumbnail height (default: 68) */
|
|
194
|
+
previewHeight?: number;
|
|
179
195
|
}
|
|
180
196
|
declare const VideoFeedItemTimeline: react.ForwardRefExoticComponent<VideoFeedItemTimelineProps & react.RefAttributes<HTMLDivElement>>;
|
|
181
197
|
|
|
@@ -192,6 +208,8 @@ declare const VideoFeedItemOverlay: react.ForwardRefExoticComponent<VideoFeedIte
|
|
|
192
208
|
interface VideoFeedItemContextValue {
|
|
193
209
|
video: Video;
|
|
194
210
|
isActive: boolean;
|
|
211
|
+
/** Preload priority level */
|
|
212
|
+
priority: 'high' | 'medium' | 'low' | 'metadata' | 'none';
|
|
195
213
|
shouldRenderVideo: boolean;
|
|
196
214
|
preload: '' | 'none' | 'metadata' | 'auto';
|
|
197
215
|
/** Video has been preloaded and first frame is ready */
|
|
@@ -238,6 +256,78 @@ interface VideoOverlayProps {
|
|
|
238
256
|
}
|
|
239
257
|
declare function VideoOverlay({ video, timelineExpanded, style, className, }: VideoOverlayProps): react_jsx_runtime.JSX.Element;
|
|
240
258
|
|
|
259
|
+
interface VideoEnginePoolProviderProps {
|
|
260
|
+
children: ReactNode;
|
|
261
|
+
/** Pool configuration options */
|
|
262
|
+
options?: VideoEnginePoolOptions;
|
|
263
|
+
/** Platform config overrides */
|
|
264
|
+
config?: Partial<PlatformConfig>;
|
|
265
|
+
/** Force HLS.js over native (recommended for WebViews) */
|
|
266
|
+
forceHLSJS?: boolean;
|
|
267
|
+
/** Callback when slot state changes */
|
|
268
|
+
onSlotStateChange?: (slot: EngineSlot, prevState: SlotState) => void;
|
|
269
|
+
/** Callback when error occurs */
|
|
270
|
+
onError?: (slot: EngineSlot, error: Error) => void;
|
|
271
|
+
/** Callback when first frame is ready */
|
|
272
|
+
onFirstFrameReady?: (slot: EngineSlot) => void;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Provider component that creates and manages a VideoEnginePool instance.
|
|
276
|
+
* Wrap your feed or app with this provider to enable pooled video playback.
|
|
277
|
+
*/
|
|
278
|
+
declare function VideoEnginePoolProvider({ children, options, config, forceHLSJS, onSlotStateChange, onError, onFirstFrameReady, }: VideoEnginePoolProviderProps): react_jsx_runtime.JSX.Element;
|
|
279
|
+
/**
|
|
280
|
+
* Hook to access the VideoEnginePool instance.
|
|
281
|
+
* Must be used within a VideoEnginePoolProvider.
|
|
282
|
+
* Returns null during SSR or before hydration.
|
|
283
|
+
*/
|
|
284
|
+
declare function useVideoEnginePool(): VideoEnginePool | null;
|
|
285
|
+
/**
|
|
286
|
+
* Hook to check if pool is available (for conditional rendering).
|
|
287
|
+
* Returns null if not in provider context (doesn't throw).
|
|
288
|
+
*/
|
|
289
|
+
declare function useVideoEnginePoolOptional(): VideoEnginePool | null;
|
|
290
|
+
/**
|
|
291
|
+
* Hook to orchestrate the pool based on current feed position.
|
|
292
|
+
* Call this in your VideoFeed component to automatically manage preloading.
|
|
293
|
+
*
|
|
294
|
+
* @param currentIndex - Current video index in feed
|
|
295
|
+
* @param videos - Array of video data
|
|
296
|
+
* @param enabled - Whether orchestration is enabled (default: true)
|
|
297
|
+
*/
|
|
298
|
+
declare function usePoolOrchestration(currentIndex: number, videos: Video[], enabled?: boolean): void;
|
|
299
|
+
/**
|
|
300
|
+
* Hook for a single video slot management.
|
|
301
|
+
* Use this in individual video item components.
|
|
302
|
+
*
|
|
303
|
+
* @param video - Video data
|
|
304
|
+
* @param isActive - Whether this video is currently active
|
|
305
|
+
*/
|
|
306
|
+
declare function usePooledVideo(video: Video, isActive: boolean): {
|
|
307
|
+
element: HTMLVideoElement | null;
|
|
308
|
+
isReady: boolean;
|
|
309
|
+
state: SlotState | null;
|
|
310
|
+
containerRef: (node: HTMLDivElement | null) => void;
|
|
311
|
+
};
|
|
312
|
+
/**
|
|
313
|
+
* Hook to get pool statistics for debugging/monitoring.
|
|
314
|
+
*/
|
|
315
|
+
declare function usePoolStats(): {
|
|
316
|
+
totalSlots: number;
|
|
317
|
+
activeSlots: number;
|
|
318
|
+
preloadedSlots: number;
|
|
319
|
+
loadingSlots: number;
|
|
320
|
+
elementPoolSize: number;
|
|
321
|
+
} | null;
|
|
322
|
+
/**
|
|
323
|
+
* Hook to manually trigger memory reduction.
|
|
324
|
+
* Useful when you detect memory pressure.
|
|
325
|
+
*/
|
|
326
|
+
declare function usePoolMemoryControl(): {
|
|
327
|
+
reduceMemory: () => void;
|
|
328
|
+
pauseAll: () => void;
|
|
329
|
+
};
|
|
330
|
+
|
|
241
331
|
interface ConnectedVideoFeedProps extends Omit<VideoFeedProps, 'videos' | 'isLoading' | 'hasMore' | 'onLoadMore'> {
|
|
242
332
|
/**
|
|
243
333
|
* XHubReelConfig for API connection
|
|
@@ -271,6 +361,23 @@ interface ConnectedVideoFeedProps extends Omit<VideoFeedProps, 'videos' | 'isLoa
|
|
|
271
361
|
* @default true
|
|
272
362
|
*/
|
|
273
363
|
initialMuted?: boolean;
|
|
364
|
+
/**
|
|
365
|
+
* Enable Video Engine Pool for instant playback
|
|
366
|
+
* - When `true`: Uses pre-loading and pre-decoding for seamless swipe
|
|
367
|
+
* - When `false`: Uses standard video loading (simpler, less memory)
|
|
368
|
+
* @default true
|
|
369
|
+
*/
|
|
370
|
+
pooling?: boolean;
|
|
371
|
+
/**
|
|
372
|
+
* Pool configuration (only used when pooling=true)
|
|
373
|
+
*/
|
|
374
|
+
poolConfig?: VideoEnginePoolProviderProps['config'];
|
|
375
|
+
/**
|
|
376
|
+
* Force HLS.js over native HLS (only used when pooling=true)
|
|
377
|
+
* Recommended for WebViews (especially iOS) for better preloading control
|
|
378
|
+
* @default auto-detect based on platform
|
|
379
|
+
*/
|
|
380
|
+
forceHLSJS?: boolean;
|
|
274
381
|
/**
|
|
275
382
|
* Called when videos are successfully fetched
|
|
276
383
|
*/
|
|
@@ -294,6 +401,28 @@ interface ConnectedVideoFeedProps extends Omit<VideoFeedProps, 'videos' | 'isLoa
|
|
|
294
401
|
}
|
|
295
402
|
declare const ConnectedVideoFeed: react.ForwardRefExoticComponent<ConnectedVideoFeedProps & react.RefAttributes<VideoFeedRef>>;
|
|
296
403
|
|
|
404
|
+
interface PooledVideoFeedProps extends Omit<VideoFeedProps, 'children'> {
|
|
405
|
+
/** Pool configuration */
|
|
406
|
+
poolConfig?: VideoEnginePoolProviderProps['config'];
|
|
407
|
+
/** Force HLS.js over native (recommended for WebViews) */
|
|
408
|
+
forceHLSJS?: boolean;
|
|
409
|
+
/** Show timeline control */
|
|
410
|
+
showTimeline?: boolean;
|
|
411
|
+
/** Custom render function for video items */
|
|
412
|
+
renderVideoItem?: (props: {
|
|
413
|
+
video: Video;
|
|
414
|
+
isActive: boolean;
|
|
415
|
+
priority: PreloadPriority;
|
|
416
|
+
}) => React.ReactNode;
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* PooledVideoFeed - VideoFeed with automatic engine pooling
|
|
420
|
+
*
|
|
421
|
+
* This component wraps VideoFeed with VideoEnginePoolProvider for
|
|
422
|
+
* high-performance video preloading and instant playback.
|
|
423
|
+
*/
|
|
424
|
+
declare const PooledVideoFeed: react.ForwardRefExoticComponent<PooledVideoFeedProps & react.RefAttributes<VideoFeedRef>>;
|
|
425
|
+
|
|
297
426
|
/**
|
|
298
427
|
* useVideoVisibility - Track video visibility using IntersectionObserver
|
|
299
428
|
*/
|
|
@@ -453,32 +582,6 @@ declare function useMemoryManager({ videoId, estimatedSizeMB, onShouldDispose, }
|
|
|
453
582
|
*/
|
|
454
583
|
declare function useGlobalMemoryState(): MemoryState;
|
|
455
584
|
|
|
456
|
-
/**
|
|
457
|
-
* useFeedScroll - Scroll management hook with snap behavior
|
|
458
|
-
*/
|
|
459
|
-
|
|
460
|
-
interface UseFeedScrollOptions {
|
|
461
|
-
/** Scroll container ref */
|
|
462
|
-
scrollRef: RefObject<HTMLElement | null>;
|
|
463
|
-
/** Total number of items */
|
|
464
|
-
itemCount: number;
|
|
465
|
-
/** Height of each item (default: viewport height) */
|
|
466
|
-
itemHeight?: number;
|
|
467
|
-
/** Callback when scroll position changes */
|
|
468
|
-
onScrollChange?: (scrollTop: number, velocity: number) => void;
|
|
469
|
-
/** Callback when current index changes */
|
|
470
|
-
onIndexChange?: (index: number) => void;
|
|
471
|
-
}
|
|
472
|
-
interface UseFeedScrollReturn {
|
|
473
|
-
currentIndex: number;
|
|
474
|
-
scrollVelocity: number;
|
|
475
|
-
isScrolling: boolean;
|
|
476
|
-
scrollToIndex: (index: number, smooth?: boolean) => void;
|
|
477
|
-
scrollToNext: () => void;
|
|
478
|
-
scrollToPrev: () => void;
|
|
479
|
-
}
|
|
480
|
-
declare function useFeedScroll({ scrollRef, itemCount, itemHeight, onScrollChange, onIndexChange, }: UseFeedScrollOptions): UseFeedScrollReturn;
|
|
481
|
-
|
|
482
585
|
/**
|
|
483
586
|
* useInfiniteScroll - Hook for infinite scroll loading
|
|
484
587
|
*/
|
|
@@ -661,4 +764,4 @@ interface UseSwipeAnimationReturn {
|
|
|
661
764
|
}
|
|
662
765
|
declare function useSwipeAnimation({ trackRef, transitionDuration, easing, onTransitionEnd, }: UseSwipeAnimationOptions): UseSwipeAnimationReturn;
|
|
663
766
|
|
|
664
|
-
export { ConnectedVideoFeed, type ConnectedVideoFeedProps, type MemoryState,
|
|
767
|
+
export { ConnectedVideoFeed, type ConnectedVideoFeedProps, type MemoryState, PooledVideoFeed, type PooledVideoFeedProps, type PreloadPriority, type UseInfiniteScrollOptions, type UseInfiniteScrollReturn, type UseMemoryManagerOptions, type UseMemoryManagerReturn, type UseSwipeAnimationOptions, type UseSwipeAnimationReturn, type UseVideoActivationOptions, type UseVideoActivationReturn, type UseVideoFeedOptions, type UseVideoFeedReturn, type UseVideoVisibilityOptions, type UseVideoVisibilityReturn, VideoEnginePoolProvider, type VideoEnginePoolProviderProps, VideoFeed, VideoFeedItem, VideoFeedItemActions, type VideoFeedItemActionsProps, type VideoFeedItemContextValue, VideoFeedItemOverlay, type VideoFeedItemOverlayProps, VideoFeedItemPlayer, type VideoFeedItemPlayerProps, type VideoFeedItemProps, VideoFeedItemTimeline, type VideoFeedItemTimelineProps, type VideoFeedProps, type VideoFeedRef, type VideoMemoryEntry, VideoOverlay, type VideoOverlayProps, getPreloadPriority, getPreloadPriorityForFeed, mapPriorityToNumeric, memoryManager, prefetchVideoFeed, useGlobalMemoryState, useInfiniteScroll, useMemoryManager, usePoolMemoryControl, usePoolOrchestration, usePoolStats, usePooledVideo, useSwipeAnimation, useVideoActivation, useVideoEnginePool, useVideoEnginePoolOptional, useVideoFeed, useVideoFeedItemContext, useVideoVisibility };
|