@livo-tv/blocks 1.32.0 → 1.33.0

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.
@@ -0,0 +1,611 @@
1
+ import * as React from 'react';
2
+ import { HlsConfig, RetryConfig, LoaderResponse } from 'hls.js';
3
+
4
+ declare const SHADER_CURTAIN_TYPES: readonly ["plane", "sphere", "waterPlane"];
5
+ declare const SHADER_VARIANTS: readonly ["defaults", "cosmic", "glass", "positionMix"];
6
+ declare const SHADER_LIGHT_TYPES: readonly ["3d", "env"];
7
+ declare const SHADER_ENV_PRESETS: readonly ["city", "dawn", "lobby"];
8
+ declare const SHADER_ON_OFF: readonly ["on", "off"];
9
+ declare const SHADER_RANGE: readonly ["enabled", "disabled"];
10
+ type ShaderCurtainConfig = {
11
+ type: (typeof SHADER_CURTAIN_TYPES)[number];
12
+ shader: (typeof SHADER_VARIANTS)[number];
13
+ animate: (typeof SHADER_ON_OFF)[number];
14
+ uTime: number;
15
+ uSpeed: number;
16
+ uStrength: number;
17
+ uDensity: number;
18
+ uFrequency: number;
19
+ uAmplitude: number;
20
+ wireframe: boolean;
21
+ loop: (typeof SHADER_ON_OFF)[number];
22
+ loopDuration: number;
23
+ range: (typeof SHADER_RANGE)[number];
24
+ rangeStart: number;
25
+ rangeEnd: number;
26
+ positionX: number;
27
+ positionY: number;
28
+ positionZ: number;
29
+ rotationX: number;
30
+ rotationY: number;
31
+ rotationZ: number;
32
+ color1: string;
33
+ color2: string;
34
+ color3: string;
35
+ reflection: number;
36
+ brightness: number;
37
+ cAzimuthAngle: number;
38
+ cPolarAngle: number;
39
+ cDistance: number;
40
+ cameraZoom: number;
41
+ fov: number;
42
+ zoomOut: boolean;
43
+ lightType: (typeof SHADER_LIGHT_TYPES)[number];
44
+ envPreset: (typeof SHADER_ENV_PRESETS)[number];
45
+ grain: (typeof SHADER_ON_OFF)[number];
46
+ grainBlending: number;
47
+ pixelDensity: number;
48
+ };
49
+ declare const DEFAULT_SHADER_CURTAIN_CONFIG: ShaderCurtainConfig;
50
+ type ShaderCurtainPreset = {
51
+ id: string;
52
+ title: string;
53
+ config: ShaderCurtainConfig;
54
+ };
55
+ declare const SHADER_CURTAIN_PRESETS: readonly ShaderCurtainPreset[];
56
+ declare function mergeShaderCurtainConfig(partial?: Partial<ShaderCurtainConfig> | null): ShaderCurtainConfig;
57
+ declare function parseShaderGradientUrl(input: string): ShaderCurtainConfig | null;
58
+ declare function toShaderGradientUrl(config: ShaderCurtainConfig): string;
59
+ declare function isShaderCurtainKind(kind: string): kind is "shader";
60
+
61
+ type CurtainKind = "image" | "video" | "shader";
62
+ interface CurtainStageLabels {
63
+ play?: string;
64
+ tapToUnmute?: string;
65
+ mute?: string;
66
+ unmute?: string;
67
+ }
68
+ interface CurtainStageProps {
69
+ kind: CurtainKind;
70
+ url: string;
71
+ alt?: string;
72
+ className?: string;
73
+ config?: ShaderCurtainConfig;
74
+ envBasePath?: string;
75
+ /** When true, video curtains show a static frame instead of looping. */
76
+ reducedMotion?: boolean;
77
+ /**
78
+ * Waiting-room only. Starts muted, then offers tap-to-unmute when the
79
+ * file has (or may have) an audio track. Picker tiles leave this off.
80
+ */
81
+ allowSound?: boolean;
82
+ labels?: CurtainStageLabels;
83
+ }
84
+ /**
85
+ * Waiting-room backdrop: a still image or a looping video that starts muted.
86
+ * Honors `prefers-reduced-motion` (or an explicit `reducedMotion` prop)
87
+ * by freezing video on the first frame. `allowSound` offers tap-to-unmute
88
+ * when the file has audio.
89
+ */
90
+ declare function CurtainStage({ kind, url, alt, className, config, envBasePath, reducedMotion, allowSound, labels, }: CurtainStageProps): React.JSX.Element;
91
+
92
+ type CurtainPreviewProps = {
93
+ kind: CurtainKind | string;
94
+ url: string | null;
95
+ alt?: string;
96
+ className?: string;
97
+ /**
98
+ * When true (default), video curtains loop only while the tile is on
99
+ * screen. Off-screen and `prefers-reduced-motion` tiles stay on a
100
+ * static first frame so a large grid does not play every loop at once.
101
+ */
102
+ playWhenVisible?: boolean;
103
+ /** Force a static first frame even when the tile is visible. */
104
+ frozen?: boolean;
105
+ };
106
+ /**
107
+ * Thumbnail for a curtain asset: still image, or a muted looping video
108
+ * that plays only while visible (unless reduced motion is on).
109
+ */
110
+ declare function CurtainPreview({ kind, url, alt, className, playWhenVisible, frozen, }: CurtainPreviewProps): React.JSX.Element;
111
+
112
+ type CurtainPickerOwnerType = "organization" | "platform" | string;
113
+ type CurtainPickerItem = {
114
+ id: string;
115
+ title: string;
116
+ kind: CurtainKind | string;
117
+ publicUrl: string | null;
118
+ ownerType?: CurtainPickerOwnerType;
119
+ /** Consumer-computed default (org setting or platform `isDefault`). */
120
+ isDefault?: boolean;
121
+ };
122
+ type CurtainPickerLabels = {
123
+ select?: string;
124
+ none?: string;
125
+ noneDescription?: string;
126
+ defaultBadge?: string;
127
+ makeDefault?: string;
128
+ edit?: string;
129
+ delete?: string;
130
+ image?: string;
131
+ video?: string;
132
+ shader?: string;
133
+ organization?: string;
134
+ platform?: string;
135
+ groupOrganization?: string;
136
+ groupPlatform?: string;
137
+ groupOther?: string;
138
+ emptyTitle?: string;
139
+ emptyDescription?: string;
140
+ };
141
+ declare const DEFAULT_CURTAIN_PICKER_LABELS: Required<CurtainPickerLabels>;
142
+ type CurtainPickerProps = {
143
+ curtains: CurtainPickerItem[];
144
+ /** Selected curtain id. `null` / `""` means the optional None tile. */
145
+ value?: string | null;
146
+ onChange?: (id: string | null) => void;
147
+ allowNone?: boolean;
148
+ disabled?: boolean;
149
+ /** `compact` is a selected preview plus a dense thumbnail grid. */
150
+ variant?: "default" | "compact";
151
+ /** Split the grid into organization / platform / other sections. */
152
+ groupByOwner?: boolean;
153
+ onMakeDefault?: (item: CurtainPickerItem) => void;
154
+ onEdit?: (item: CurtainPickerItem) => void;
155
+ onDelete?: (item: CurtainPickerItem) => void;
156
+ canMakeDefault?: (item: CurtainPickerItem) => boolean;
157
+ canDelete?: (item: CurtainPickerItem) => boolean;
158
+ labels?: CurtainPickerLabels;
159
+ emptyAction?: React.ReactNode;
160
+ className?: string;
161
+ /** Disable action buttons while a mutation is in flight. */
162
+ actionsPending?: boolean;
163
+ };
164
+ declare function CurtainPickerSkeleton({ count, variant, className, }: {
165
+ count?: number;
166
+ variant?: "default" | "compact";
167
+ className?: string;
168
+ }): React.JSX.Element;
169
+ /**
170
+ * Presentational curtain catalog: visual image / looping-video tiles,
171
+ * optional selection (including None), and optional manage actions.
172
+ * Consumers fetch, upload, and confirm deletes themselves.
173
+ */
174
+ declare function CurtainPicker({ curtains, value, onChange, allowNone, disabled, variant, groupByOwner, onMakeDefault, onEdit, onDelete, canMakeDefault, canDelete, labels, emptyAction, className, actionsPending, }: CurtainPickerProps): React.JSX.Element;
175
+
176
+ interface WaitingRoomCurtain {
177
+ kind: CurtainKind;
178
+ url: string;
179
+ config?: ShaderCurtainConfig;
180
+ envBasePath?: string;
181
+ }
182
+ interface WaitingRoomProps {
183
+ title: string;
184
+ organizationName?: string | null;
185
+ organizationImage?: string | null;
186
+ startsAt?: number | null;
187
+ durationSeconds?: number | null;
188
+ curtain?: WaitingRoomCurtain | null;
189
+ hideBranding?: boolean;
190
+ hideStatus?: boolean;
191
+ nowMs?: number;
192
+ labels?: {
193
+ startsIn?: string;
194
+ started?: string;
195
+ duration?: (minutes: number) => string;
196
+ };
197
+ className?: string;
198
+ }
199
+ /**
200
+ * Public waiting-room chrome: curtain (or calm branded fallback), title,
201
+ * org avatar, and a countdown to `startsAt`.
202
+ */
203
+ declare function WaitingRoom({ title, organizationName, organizationImage, startsAt, durationSeconds, curtain, hideBranding, hideStatus, nowMs, labels, className, }: WaitingRoomProps): React.JSX.Element;
204
+
205
+ type ShaderCurtainProps = {
206
+ config: ShaderCurtainConfig | Partial<ShaderCurtainConfig>;
207
+ posterUrl?: string | null;
208
+ envBasePath?: string;
209
+ className?: string;
210
+ /** Editor only — needed for canvas.toBlob capture. */
211
+ preserveDrawingBuffer?: boolean;
212
+ reducedMotion?: boolean;
213
+ alt?: string;
214
+ };
215
+ /**
216
+ * Live ShaderGradient canvas with a poster fallback while the optional
217
+ * WebGL peers load, when WebGL is missing, or when motion is reduced.
218
+ */
219
+ declare function ShaderCurtain({ config, posterUrl, envBasePath, className, preserveDrawingBuffer, reducedMotion, alt, }: ShaderCurtainProps): React.JSX.Element;
220
+
221
+ type ShaderCurtainEditorLabels = {
222
+ shape?: string;
223
+ colors?: string;
224
+ light?: string;
225
+ camera?: string;
226
+ presets?: string;
227
+ importUrl?: string;
228
+ importApply?: string;
229
+ importError?: string;
230
+ };
231
+ declare const DEFAULT_SHADER_CURTAIN_EDITOR_LABELS: Required<ShaderCurtainEditorLabels>;
232
+ type ShaderCurtainEditorHandle = {
233
+ getConfig: () => ShaderCurtainConfig;
234
+ capturePoster: () => Promise<Blob | null>;
235
+ };
236
+ type ShaderCurtainEditorProps = {
237
+ value?: Partial<ShaderCurtainConfig>;
238
+ onChange?: (config: ShaderCurtainConfig) => void;
239
+ envBasePath?: string;
240
+ className?: string;
241
+ labels?: ShaderCurtainEditorLabels;
242
+ };
243
+ declare const ShaderCurtainEditor: React.ForwardRefExoticComponent<ShaderCurtainEditorProps & React.RefAttributes<ShaderCurtainEditorHandle>>;
244
+
245
+ type CaptureShaderPosterOptions = {
246
+ quality?: number;
247
+ type?: "image/jpeg" | "image/png";
248
+ };
249
+ /**
250
+ * Snapshot the live ShaderGradient canvas. The editor must pass
251
+ * `preserveDrawingBuffer` or the pixels will be empty.
252
+ */
253
+ declare function captureShaderPoster(root: HTMLElement, options?: CaptureShaderPosterOptions): Promise<Blob | null>;
254
+
255
+ type CastFramework = {
256
+ CastContext: {
257
+ getInstance: () => {
258
+ setOptions: (options: {
259
+ receiverApplicationId: string;
260
+ autoJoinPolicy?: string;
261
+ }) => void;
262
+ requestSession: () => Promise<unknown>;
263
+ getCurrentSession: () => {
264
+ loadMedia: (request: unknown) => Promise<unknown>;
265
+ } | null;
266
+ };
267
+ };
268
+ };
269
+ type ChromeCast = {
270
+ media: {
271
+ DEFAULT_MEDIA_RECEIVER_APP_ID: string;
272
+ MediaInfo: new (url: string, contentType: string) => unknown;
273
+ LoadRequest: new (media: unknown) => unknown;
274
+ };
275
+ AutoJoinPolicy?: {
276
+ ORIGIN_SCOPED: string;
277
+ };
278
+ };
279
+ declare global {
280
+ interface Window {
281
+ cast?: {
282
+ framework?: CastFramework;
283
+ };
284
+ chrome?: {
285
+ cast?: ChromeCast;
286
+ };
287
+ __onGCastApiAvailable?: (available: boolean) => void;
288
+ }
289
+ }
290
+ declare function loadCastSender(): Promise<void>;
291
+ /** Cast an HLS master playlist to the default Chromecast media receiver. */
292
+ declare function castHlsUrl(hlsUrl: string): Promise<void>;
293
+
294
+ /**
295
+ * Playback error description, ported from the app's HLS player but stripped of
296
+ * Sentry. `@livo/blocks` must stay reporting-agnostic: the player surfaces
297
+ * a {@link DescribedPlaybackError} through an optional `onError` prop so each
298
+ * app can wire its own reporting (Sentry, Datadog, console, …).
299
+ *
300
+ * User-facing messages are intentionally NOT baked in here — they come from the
301
+ * player's `labels` prop so they stay translatable. This module only classifies
302
+ * the error and produces a machine-readable summary + detail for logging.
303
+ */
304
+ type HlsPlayerMode = "live" | "vod";
305
+ /** Coarse category the player uses to pick the right localized message. */
306
+ type PlaybackErrorKind = "unavailable" | "network" | "media" | "unsupported" | "resync" | "generic";
307
+ type PlaybackErrorContext = {
308
+ mode: HlsPlayerMode;
309
+ src: string;
310
+ manifestParsed: boolean;
311
+ retryCount?: number;
312
+ source: "hls" | "native" | "unsupported";
313
+ };
314
+ type PlaybackErrorDetail = {
315
+ source: PlaybackErrorContext["source"];
316
+ kind: PlaybackErrorKind;
317
+ type?: string;
318
+ details?: string;
319
+ fatal?: boolean;
320
+ httpStatus?: number;
321
+ url?: string;
322
+ reason?: string;
323
+ errorMessage?: string;
324
+ mediaErrorCode?: number;
325
+ mediaErrorName?: string;
326
+ context: PlaybackErrorContext;
327
+ };
328
+ type DescribePlaybackErrorInput = {
329
+ source: "hls";
330
+ type?: string;
331
+ details?: string;
332
+ fatal: boolean;
333
+ url?: string;
334
+ response?: {
335
+ code?: number;
336
+ text?: string;
337
+ };
338
+ reason?: string;
339
+ error?: unknown;
340
+ context: PlaybackErrorContext;
341
+ } | {
342
+ source: "native";
343
+ mediaError?: MediaError | null;
344
+ context: PlaybackErrorContext;
345
+ } | {
346
+ source: "unsupported";
347
+ context: PlaybackErrorContext;
348
+ };
349
+ type DescribedPlaybackError = {
350
+ /** Machine-readable one-line summary for logs. */
351
+ summary: string;
352
+ /** Coarse category for choosing a localized message. */
353
+ kind: PlaybackErrorKind;
354
+ detail: PlaybackErrorDetail;
355
+ };
356
+ /**
357
+ * Soft (non-fatal) report for an automatic A/V resync. Apps should treat this
358
+ * like other non-fatal playback events (breadcrumb / warn), never as a hard
359
+ * error UI — the player recovers in place.
360
+ */
361
+ declare function describeAvResync(input: {
362
+ lagSeconds: number;
363
+ context: PlaybackErrorContext;
364
+ }): DescribedPlaybackError;
365
+ declare function describePlaybackError(input: DescribePlaybackErrorInput): DescribedPlaybackError;
366
+
367
+ interface PlaybackStats {
368
+ /** Concurrent live viewers (meaningful in live mode). */
369
+ viewers?: number;
370
+ /** Cumulative VOD reproductions. */
371
+ views?: number;
372
+ }
373
+ interface UsePlaybackStatsOptions {
374
+ /** Poll interval in ms. Default 15000. */
375
+ intervalMs?: number;
376
+ /** When false, polling is paused. Default true. */
377
+ enabled?: boolean;
378
+ }
379
+ /**
380
+ * Polls a playback-stats endpoint (media-svc `GET /playback/:mediaId/stats`)
381
+ * and returns `{ viewers, views }`. Plain `fetch`, zero dependencies, so wiring
382
+ * it into an app is a one-liner. Fails silently (stats are non-critical); the
383
+ * last successful value is retained across transient errors.
384
+ */
385
+ declare function usePlaybackStats(statsUrl: string | null | undefined, { intervalMs, enabled }?: UsePlaybackStatsOptions): PlaybackStats;
386
+
387
+ declare const CAPTION_LOCALES: readonly ["en", "es", "pt"];
388
+ type CaptionLocale = (typeof CAPTION_LOCALES)[number];
389
+ declare function isCaptionLocale(value: string): value is CaptionLocale;
390
+ declare function captionsVttUrlFromPlayback(src: string, locale: CaptionLocale): string | null;
391
+
392
+ interface VideoPlayerLabels {
393
+ play?: string;
394
+ pause?: string;
395
+ mute?: string;
396
+ unmute?: string;
397
+ enterFullscreen?: string;
398
+ exitFullscreen?: string;
399
+ pictureInPicture?: string;
400
+ cast?: string;
401
+ settings?: string;
402
+ /** Overflow menu for speed / quality / cast / PiP on a narrow player. */
403
+ more?: string;
404
+ /** Back control on compact More speed / quality panes. */
405
+ back?: string;
406
+ quality?: string;
407
+ auto?: string;
408
+ speed?: string;
409
+ live?: string;
410
+ goLive?: string;
411
+ tapToUnmute?: string;
412
+ loading?: string;
413
+ waiting?: string;
414
+ retry?: string;
415
+ /** Messages by error kind; a generic fallback covers the rest. */
416
+ errorUnavailable?: string;
417
+ errorNetwork?: string;
418
+ errorMedia?: string;
419
+ errorUnsupported?: string;
420
+ errorGeneric?: string;
421
+ /** `(n) => "N watching"`. */
422
+ formatViewers?: (n: number) => string;
423
+ /** `(n) => "N views"`. */
424
+ formatViews?: (n: number) => string;
425
+ captions?: string;
426
+ captionsOff?: string;
427
+ captionsEn?: string;
428
+ captionsEs?: string;
429
+ captionsPt?: string;
430
+ /** @deprecated Unused after movie-style captions; kept for existing callers. */
431
+ captionsLatest?: string;
432
+ }
433
+ interface VideoPlayerProps {
434
+ src: string;
435
+ mode: "live" | "vod";
436
+ /** Cover image; renders a click-to-play state before attaching HLS. */
437
+ poster?: string;
438
+ autoPlay?: boolean;
439
+ muted?: boolean;
440
+ /** Presentational stats (see `usePlaybackStats`). */
441
+ stats?: PlaybackStats;
442
+ labels?: VideoPlayerLabels;
443
+ /** Show the resolution picker when multiple levels exist. Default true. */
444
+ showQualitySelector?: boolean;
445
+ /**
446
+ * When true, force-pauses the media element. Clearing it does not
447
+ * auto-resume — the user must press play again.
448
+ */
449
+ paused?: boolean;
450
+ onPlayingChange?: (playing: boolean) => void;
451
+ /** Fires once, the first time playback actually starts — wire your view
452
+ * beacon here. */
453
+ onFirstPlay?: () => void;
454
+ onError?: (error: DescribedPlaybackError) => void;
455
+ /** Throttled ~5s while the playhead advances. */
456
+ onPlaybackProgress?: (currentTime: number, duration: number) => void;
457
+ onRebuffer?: (seconds: number) => void;
458
+ onQualityChange?: (quality: string) => void;
459
+ /**
460
+ * Default `aspect-video` for feed cards. Use `contain` in fullscreen
461
+ * viewers so portrait sources fill the pane with object-fit and controls
462
+ * stay at the bottom of the pane.
463
+ */
464
+ fit?: "aspect-video" | "contain";
465
+ className?: string;
466
+ /** Optional initial CC language. Defaults to Off. UI locale / `?lang=` do not enable captions. */
467
+ defaultCaptionLocale?: CaptionLocale;
468
+ /**
469
+ * When false, hide the CC menu and do not attach sidecar or live caption
470
+ * tracks. Defaults to true so existing callers keep current behavior.
471
+ */
472
+ captionsEnabled?: boolean;
473
+ /** Live poll base, e.g. `https://api.livo.tv/public/streams/{id}/captions`. */
474
+ liveCaptionsBaseUrl?: string | null;
475
+ }
476
+ /**
477
+ * Standardized HLS video player with a fully custom control bar (no native
478
+ * `controls`): click-to-play poster, play/pause, mute + volume, resolution
479
+ * picker, playback speed (VOD), Picture-in-Picture, fullscreen, a VOD seekbar
480
+ * with buffered ranges, and a live badge (no seekbar) with a "go live"
481
+ * affordance. `stats` renders live viewer / VOD reproduction counts.
482
+ *
483
+ * hls.js is a peer dependency loaded on demand; see {@link useHlsPlayback}.
484
+ */
485
+ declare function VideoPlayer({ src, mode, poster, autoPlay, muted, stats, labels, showQualitySelector, paused, onPlayingChange, onFirstPlay, onError, onPlaybackProgress, onRebuffer, onQualityChange, fit, className, defaultCaptionLocale, captionsEnabled, liveCaptionsBaseUrl, }: VideoPlayerProps): React.JSX.Element;
486
+
487
+ interface FeedVideoPlayerProps extends VideoPlayerProps {
488
+ /** Stable id for exclusive playback (typically the feed post id). */
489
+ playbackId: string;
490
+ }
491
+ /**
492
+ * Feed-scoped {@link VideoPlayer}: only one feed video plays at a time, and
493
+ * playback autopauses when the card leaves the viewport or the tab is hidden.
494
+ */
495
+ declare function FeedVideoPlayer({ playbackId, onPlayingChange, paused: pausedProp, fit, className, ...playerProps }: FeedVideoPlayerProps): React.JSX.Element;
496
+
497
+ interface UseFeedExclusivePlaybackResult {
498
+ containerRef: React.RefObject<HTMLDivElement | null>;
499
+ paused: boolean;
500
+ onPlayingChange: (playing: boolean) => void;
501
+ }
502
+ /**
503
+ * Coordinates exclusive feed playback: claims the global slot on play,
504
+ * force-pauses when another feed video plays, when the player leaves the
505
+ * viewport, or when the tab is hidden. Picture-in-Picture is exempt from
506
+ * scroll/visibility autopause.
507
+ */
508
+ declare function useFeedExclusivePlayback(playbackId: string): UseFeedExclusivePlaybackResult;
509
+
510
+ type PlaybackState = "idle" | "loading" | "ready" | "waiting" | "error";
511
+ /** Autoplay overlay state once the manifest is parsed. */
512
+ type AutoplayState = "none" | "playing" | "muted" | "blocked";
513
+ interface QualityLevel {
514
+ /** hls.js level index. */
515
+ index: number;
516
+ /** Vertical resolution, e.g. 720. */
517
+ height: number;
518
+ }
519
+ interface UseHlsPlaybackOptions {
520
+ src: string;
521
+ mode: HlsPlayerMode;
522
+ /** When false, nothing is attached/loaded (poster gating). */
523
+ active: boolean;
524
+ /** Attempt autoplay once the manifest is ready. Live always autoplays. */
525
+ autoPlay?: boolean;
526
+ /** Start muted (independent of the autoplay cascade). */
527
+ muted?: boolean;
528
+ onError?: (error: DescribedPlaybackError) => void;
529
+ onPlayingChange?: (playing: boolean) => void;
530
+ onRebuffer?: (seconds: number) => void;
531
+ onQualityChange?: (quality: string) => void;
532
+ }
533
+ interface UseHlsPlaybackResult {
534
+ videoRef: React.RefObject<HTMLVideoElement | null>;
535
+ state: PlaybackState;
536
+ /** Available quality levels (empty for native HLS / single-level). */
537
+ qualities: QualityLevel[];
538
+ /** Selected level index, or -1 for automatic. */
539
+ activeLevel: number;
540
+ setLevel: (index: number) => void;
541
+ autoplayState: AutoplayState;
542
+ /** The classified error, when `state === "error"`. */
543
+ error: DescribedPlaybackError | null;
544
+ retry: () => void;
545
+ /**
546
+ * Chrome mode derived from the playlist. A `/live/` src stays `"live"`
547
+ * until hls.js reports `#EXT-X-ENDLIST` (`details.live === false`).
548
+ * Non-live srcs follow the `mode` prop.
549
+ */
550
+ effectiveMode: HlsPlayerMode;
551
+ }
552
+ /**
553
+ * Attaches hls.js (loaded on demand via dynamic import) or native HLS to a
554
+ * `<video>` element and exposes the state a custom control bar needs. Ported
555
+ * from the app's production `HlsPlayer` effect, minus the built-in UI and
556
+ * Sentry: errors are classified and handed to `onError`.
557
+ */
558
+ declare function useHlsPlayback({ src, mode, active, autoPlay, muted, onError, onPlayingChange, onRebuffer, onQualityChange, }: UseHlsPlaybackOptions): UseHlsPlaybackResult;
559
+
560
+ /** Retry transient live-edge 404s; hls.js skips all 4xx by default. */
561
+ declare function shouldRetryLiveEdge404(retryConfig: RetryConfig | null | undefined, retryCount: number, _isTimeout: boolean, loaderResponse: LoaderResponse | undefined, defaultRetry: boolean): boolean;
562
+ /**
563
+ * HLS.js options tuned for live playback through a Cloudflare R2 custom domain.
564
+ * Ported from the app's production player: stays 4 segments (~8s) behind the
565
+ * live edge so transient upload lag never reaches the playhead, and retries the
566
+ * 404s that appear while a new segment is still being written.
567
+ */
568
+ declare function createLiveHlsConfig(): Partial<HlsConfig>;
569
+ /**
570
+ * HLS.js options for on-demand (VOD) playback. No live-edge cushion; enables
571
+ * the worker and lets hls.js manage the buffer with its defaults, which are
572
+ * well suited to seekable recordings.
573
+ */
574
+ declare function createVodHlsConfig(): Partial<HlsConfig>;
575
+
576
+ type PlaybackBeaconEventType = "view" | "progress" | "rebuffer" | "quality_change" | "error";
577
+ type PlaybackBeaconSurface = "app" | "player" | "embed" | "sdk";
578
+ type PlaybackBeaconEvent = {
579
+ type: PlaybackBeaconEventType;
580
+ ts: number;
581
+ streamId?: string;
582
+ vodId?: string;
583
+ currentTime?: number;
584
+ duration?: number;
585
+ rebufferSeconds?: number;
586
+ quality?: string;
587
+ errorCode?: string;
588
+ surface?: PlaybackBeaconSurface | string;
589
+ [key: string]: unknown;
590
+ };
591
+ type PlaybackBeaconTrackInput = Omit<PlaybackBeaconEvent, "ts"> & {
592
+ ts?: number;
593
+ };
594
+ type CreatePlaybackBeaconClientOptions = {
595
+ endpoint: string;
596
+ sessionId: string;
597
+ surface: PlaybackBeaconSurface | string;
598
+ getContext?: () => Record<string, unknown>;
599
+ /** Override for tests. */
600
+ fetchFn?: typeof fetch;
601
+ intervalMs?: number;
602
+ now?: () => number;
603
+ };
604
+ type PlaybackBeaconClient = {
605
+ track: (event: PlaybackBeaconTrackInput) => void;
606
+ flush: () => Promise<void>;
607
+ destroy: () => void;
608
+ };
609
+ declare function createPlaybackBeaconClient({ endpoint, sessionId, surface, getContext, fetchFn, intervalMs, now, }: CreatePlaybackBeaconClientOptions): PlaybackBeaconClient;
610
+
611
+ export { type AutoplayState, CAPTION_LOCALES, type CaptionLocale, type CreatePlaybackBeaconClientOptions, type CurtainKind, CurtainPicker, type CurtainPickerItem, type CurtainPickerLabels, type CurtainPickerOwnerType, type CurtainPickerProps, CurtainPickerSkeleton, CurtainPreview, type CurtainPreviewProps, CurtainStage, type CurtainStageLabels, type CurtainStageProps, DEFAULT_CURTAIN_PICKER_LABELS, DEFAULT_SHADER_CURTAIN_CONFIG, DEFAULT_SHADER_CURTAIN_EDITOR_LABELS, type DescribedPlaybackError, FeedVideoPlayer, type FeedVideoPlayerProps, type HlsPlayerMode, type PlaybackBeaconClient, type PlaybackBeaconEvent, type PlaybackBeaconEventType, type PlaybackBeaconSurface, type PlaybackBeaconTrackInput, type PlaybackErrorContext, type PlaybackErrorDetail, type PlaybackErrorKind, type PlaybackState, type PlaybackStats, type QualityLevel, SHADER_CURTAIN_PRESETS, ShaderCurtain, type ShaderCurtainConfig, ShaderCurtainEditor, type ShaderCurtainEditorHandle, type ShaderCurtainEditorLabels, type ShaderCurtainEditorProps, type ShaderCurtainPreset, type ShaderCurtainProps, type UseFeedExclusivePlaybackResult, type UseHlsPlaybackOptions, type UseHlsPlaybackResult, type UsePlaybackStatsOptions, VideoPlayer, type VideoPlayerLabels, type VideoPlayerProps, WaitingRoom, type WaitingRoomCurtain, type WaitingRoomProps, captionsVttUrlFromPlayback, captureShaderPoster, castHlsUrl, createLiveHlsConfig, createPlaybackBeaconClient, createVodHlsConfig, describeAvResync, describePlaybackError, isCaptionLocale, isShaderCurtainKind, loadCastSender, mergeShaderCurtainConfig, parseShaderGradientUrl, shouldRetryLiveEdge404, toShaderGradientUrl, useFeedExclusivePlayback, useHlsPlayback, usePlaybackStats };