@livepeer-frameworks/player-react 0.0.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.
Files changed (88) hide show
  1. package/dist/cjs/index.js +2 -0
  2. package/dist/cjs/index.js.map +1 -0
  3. package/dist/esm/index.js +2 -0
  4. package/dist/esm/index.js.map +1 -0
  5. package/dist/types/components/DevModePanel.d.ts +47 -0
  6. package/dist/types/components/DvdLogo.d.ts +4 -0
  7. package/dist/types/components/Icons.d.ts +33 -0
  8. package/dist/types/components/IdleScreen.d.ts +16 -0
  9. package/dist/types/components/LoadingScreen.d.ts +6 -0
  10. package/dist/types/components/LogoOverlay.d.ts +11 -0
  11. package/dist/types/components/Player.d.ts +11 -0
  12. package/dist/types/components/PlayerControls.d.ts +60 -0
  13. package/dist/types/components/PlayerErrorBoundary.d.ts +23 -0
  14. package/dist/types/components/SeekBar.d.ts +33 -0
  15. package/dist/types/components/SkipIndicator.d.ts +14 -0
  16. package/dist/types/components/SpeedIndicator.d.ts +12 -0
  17. package/dist/types/components/StatsPanel.d.ts +31 -0
  18. package/dist/types/components/StreamStateOverlay.d.ts +24 -0
  19. package/dist/types/components/SubtitleRenderer.d.ts +69 -0
  20. package/dist/types/components/ThumbnailOverlay.d.ts +4 -0
  21. package/dist/types/components/TitleOverlay.d.ts +13 -0
  22. package/dist/types/components/players/DashJsPlayer.d.ts +18 -0
  23. package/dist/types/components/players/HlsJsPlayer.d.ts +18 -0
  24. package/dist/types/components/players/MewsWsPlayer/index.d.ts +18 -0
  25. package/dist/types/components/players/MistPlayer.d.ts +20 -0
  26. package/dist/types/components/players/MistWebRTCPlayer/index.d.ts +20 -0
  27. package/dist/types/components/players/NativePlayer.d.ts +19 -0
  28. package/dist/types/components/players/VideoJsPlayer.d.ts +18 -0
  29. package/dist/types/context/PlayerContext.d.ts +40 -0
  30. package/dist/types/context/index.d.ts +5 -0
  31. package/dist/types/hooks/useMetaTrack.d.ts +54 -0
  32. package/dist/types/hooks/usePlaybackQuality.d.ts +42 -0
  33. package/dist/types/hooks/usePlayerController.d.ts +163 -0
  34. package/dist/types/hooks/usePlayerSelection.d.ts +47 -0
  35. package/dist/types/hooks/useStreamState.d.ts +27 -0
  36. package/dist/types/hooks/useTelemetry.d.ts +57 -0
  37. package/dist/types/hooks/useViewerEndpoints.d.ts +14 -0
  38. package/dist/types/index.d.ts +33 -0
  39. package/dist/types/types.d.ts +94 -0
  40. package/dist/types/ui/badge.d.ts +9 -0
  41. package/dist/types/ui/button.d.ts +11 -0
  42. package/dist/types/ui/context-menu.d.ts +27 -0
  43. package/dist/types/ui/select.d.ts +10 -0
  44. package/dist/types/ui/slider.d.ts +13 -0
  45. package/package.json +71 -0
  46. package/src/assets/logomark.svg +56 -0
  47. package/src/components/DevModePanel.tsx +822 -0
  48. package/src/components/DvdLogo.tsx +201 -0
  49. package/src/components/Icons.tsx +282 -0
  50. package/src/components/IdleScreen.tsx +664 -0
  51. package/src/components/LoadingScreen.tsx +710 -0
  52. package/src/components/LogoOverlay.tsx +75 -0
  53. package/src/components/Player.tsx +419 -0
  54. package/src/components/PlayerControls.tsx +820 -0
  55. package/src/components/PlayerErrorBoundary.tsx +70 -0
  56. package/src/components/SeekBar.tsx +291 -0
  57. package/src/components/SkipIndicator.tsx +113 -0
  58. package/src/components/SpeedIndicator.tsx +57 -0
  59. package/src/components/StatsPanel.tsx +150 -0
  60. package/src/components/StreamStateOverlay.tsx +200 -0
  61. package/src/components/SubtitleRenderer.tsx +235 -0
  62. package/src/components/ThumbnailOverlay.tsx +90 -0
  63. package/src/components/TitleOverlay.tsx +48 -0
  64. package/src/components/players/DashJsPlayer.tsx +56 -0
  65. package/src/components/players/HlsJsPlayer.tsx +56 -0
  66. package/src/components/players/MewsWsPlayer/index.tsx +56 -0
  67. package/src/components/players/MistPlayer.tsx +60 -0
  68. package/src/components/players/MistWebRTCPlayer/index.tsx +59 -0
  69. package/src/components/players/NativePlayer.tsx +58 -0
  70. package/src/components/players/VideoJsPlayer.tsx +56 -0
  71. package/src/context/PlayerContext.tsx +71 -0
  72. package/src/context/index.ts +11 -0
  73. package/src/global.d.ts +4 -0
  74. package/src/hooks/useMetaTrack.ts +187 -0
  75. package/src/hooks/usePlaybackQuality.ts +126 -0
  76. package/src/hooks/usePlayerController.ts +525 -0
  77. package/src/hooks/usePlayerSelection.ts +117 -0
  78. package/src/hooks/useStreamState.ts +381 -0
  79. package/src/hooks/useTelemetry.ts +138 -0
  80. package/src/hooks/useViewerEndpoints.ts +120 -0
  81. package/src/index.tsx +75 -0
  82. package/src/player.css +2 -0
  83. package/src/types.ts +135 -0
  84. package/src/ui/badge.tsx +27 -0
  85. package/src/ui/button.tsx +47 -0
  86. package/src/ui/context-menu.tsx +193 -0
  87. package/src/ui/select.tsx +105 -0
  88. package/src/ui/slider.tsx +67 -0
@@ -0,0 +1,54 @@
1
+ import { type MetaTrackEvent } from '@livepeer-frameworks/player-core';
2
+ import type { UseMetaTrackOptions } from '../types';
3
+ export interface UseMetaTrackReturn {
4
+ /** Whether connected to MistServer WebSocket */
5
+ isConnected: boolean;
6
+ /** Connection state */
7
+ connectionState: 'disconnected' | 'connecting' | 'connected' | 'reconnecting';
8
+ /** List of subscribed track IDs */
9
+ subscribedTracks: string[];
10
+ /** Subscribe to a meta track */
11
+ subscribe: (trackId: string, callback: (event: MetaTrackEvent) => void) => () => void;
12
+ /** Unsubscribe from a meta track */
13
+ unsubscribe: (trackId: string, callback: (event: MetaTrackEvent) => void) => void;
14
+ /** Manually connect */
15
+ connect: () => void;
16
+ /** Manually disconnect */
17
+ disconnect: () => void;
18
+ /** Update playback time for timed event dispatch (call on video timeupdate) */
19
+ setPlaybackTime: (timeInSeconds: number) => void;
20
+ /** Handle seek event (call on video seeking/seeked) */
21
+ onSeek: (newTimeInSeconds: number) => void;
22
+ }
23
+ /**
24
+ * Hook for subscribing to real-time metadata from MistServer
25
+ *
26
+ * Uses native MistServer WebSocket protocol for low-latency metadata delivery:
27
+ * - Subtitles/captions
28
+ * - Live scores
29
+ * - Timed events
30
+ * - Chapter markers
31
+ *
32
+ * @example
33
+ * ```tsx
34
+ * const { isConnected, subscribe } = useMetaTrack({
35
+ * mistBaseUrl: 'https://mist.example.com',
36
+ * streamName: 'my-stream',
37
+ * enabled: true,
38
+ * });
39
+ *
40
+ * useEffect(() => {
41
+ * if (!isConnected) return;
42
+ *
43
+ * const unsubscribe = subscribe('1', (event) => {
44
+ * if (event.type === 'subtitle') {
45
+ * setSubtitle(event.data as SubtitleCue);
46
+ * }
47
+ * });
48
+ *
49
+ * return unsubscribe;
50
+ * }, [isConnected, subscribe]);
51
+ * ```
52
+ */
53
+ export declare function useMetaTrack(options: UseMetaTrackOptions): UseMetaTrackReturn;
54
+ export default useMetaTrack;
@@ -0,0 +1,42 @@
1
+ import { type PlaybackQuality } from '@livepeer-frameworks/player-core';
2
+ import type { UsePlaybackQualityOptions } from '../types';
3
+ /**
4
+ * Hook to monitor video playback quality
5
+ *
6
+ * Tracks:
7
+ * - Buffer health (seconds ahead)
8
+ * - Stall count
9
+ * - Frame drop rate
10
+ * - Estimated bitrate
11
+ * - Latency (live streams)
12
+ * - Composite quality score (0-100)
13
+ *
14
+ * @example
15
+ * ```tsx
16
+ * const { quality, isMonitoring } = usePlaybackQuality({
17
+ * videoElement,
18
+ * enabled: true,
19
+ * thresholds: { minScore: 60 },
20
+ * onQualityDegraded: (q) => console.log('Quality dropped:', q.score),
21
+ * });
22
+ *
23
+ * return <div>Quality: {quality?.score ?? '--'}</div>;
24
+ * ```
25
+ */
26
+ export declare function usePlaybackQuality(options: UsePlaybackQualityOptions): {
27
+ /** Current quality metrics */
28
+ quality: PlaybackQuality | null;
29
+ /** Whether monitoring is active */
30
+ isMonitoring: boolean;
31
+ /** Get current quality snapshot */
32
+ getCurrentQuality: () => PlaybackQuality | null;
33
+ /** Get rolling average quality */
34
+ getAverageQuality: () => PlaybackQuality | null;
35
+ /** Get quality history */
36
+ getHistory: () => PlaybackQuality[];
37
+ /** Reset stall counters */
38
+ resetStallCounters: () => void;
39
+ /** Get total stall time in ms */
40
+ getTotalStallMs: () => number;
41
+ };
42
+ export default usePlaybackQuality;
@@ -0,0 +1,163 @@
1
+ /**
2
+ * usePlayerController.ts
3
+ *
4
+ * React hook that wraps PlayerController for declarative usage.
5
+ * Manages the complete player lifecycle and provides reactive state.
6
+ */
7
+ import { PlayerController, type PlayerControllerConfig, type PlayerState, type StreamState, type StreamInfo, type PlaybackQuality, type ContentEndpoints, type ContentMetadata } from '@livepeer-frameworks/player-core';
8
+ export interface UsePlayerControllerConfig extends Omit<PlayerControllerConfig, 'playerManager'> {
9
+ /** Enable/disable the hook */
10
+ enabled?: boolean;
11
+ /** Callback when state changes */
12
+ onStateChange?: (state: PlayerState) => void;
13
+ /** Callback when stream state changes */
14
+ onStreamStateChange?: (state: StreamState) => void;
15
+ /** Callback when error occurs */
16
+ onError?: (error: string) => void;
17
+ /** Callback when ready */
18
+ onReady?: (videoElement: HTMLVideoElement) => void;
19
+ }
20
+ export interface PlayerControllerState {
21
+ /** Current player state */
22
+ state: PlayerState;
23
+ /** Stream state (for live streams) */
24
+ streamState: StreamState | null;
25
+ /** Resolved endpoints */
26
+ endpoints: ContentEndpoints | null;
27
+ /** Content metadata */
28
+ metadata: ContentMetadata | null;
29
+ /** Video element (null if not ready) */
30
+ videoElement: HTMLVideoElement | null;
31
+ /** Current time */
32
+ currentTime: number;
33
+ /** Duration */
34
+ duration: number;
35
+ /** Is playing */
36
+ isPlaying: boolean;
37
+ /** Is paused */
38
+ isPaused: boolean;
39
+ /** Is buffering */
40
+ isBuffering: boolean;
41
+ /** Is muted */
42
+ isMuted: boolean;
43
+ /** Volume (0-1) */
44
+ volume: number;
45
+ /** Error text */
46
+ error: string | null;
47
+ /** Is passive error */
48
+ isPassiveError: boolean;
49
+ /** Has playback ever started */
50
+ hasPlaybackStarted: boolean;
51
+ /** Is holding speed (2x gesture) */
52
+ isHoldingSpeed: boolean;
53
+ /** Current hold speed */
54
+ holdSpeed: number;
55
+ /** Is hovering (controls visible) */
56
+ isHovering: boolean;
57
+ /** Should show controls */
58
+ shouldShowControls: boolean;
59
+ /** Is loop enabled */
60
+ isLoopEnabled: boolean;
61
+ /** Is fullscreen */
62
+ isFullscreen: boolean;
63
+ /** Is PiP active */
64
+ isPiPActive: boolean;
65
+ /** Is effectively live (live or DVR recording) */
66
+ isEffectivelyLive: boolean;
67
+ /** Should show idle screen */
68
+ shouldShowIdleScreen: boolean;
69
+ /** Current player info */
70
+ currentPlayerInfo: {
71
+ name: string;
72
+ shortname: string;
73
+ } | null;
74
+ /** Current source info */
75
+ currentSourceInfo: {
76
+ url: string;
77
+ type: string;
78
+ } | null;
79
+ /** Playback quality metrics */
80
+ playbackQuality: PlaybackQuality | null;
81
+ /** Subtitles enabled */
82
+ subtitlesEnabled: boolean;
83
+ /** Available quality levels */
84
+ qualities: Array<{
85
+ id: string;
86
+ label: string;
87
+ bitrate?: number;
88
+ width?: number;
89
+ height?: number;
90
+ isAuto?: boolean;
91
+ active?: boolean;
92
+ }>;
93
+ /** Available text/caption tracks */
94
+ textTracks: Array<{
95
+ id: string;
96
+ label: string;
97
+ language?: string;
98
+ active: boolean;
99
+ }>;
100
+ /** Stream info for player selection (sources + tracks) */
101
+ streamInfo: StreamInfo | null;
102
+ }
103
+ export interface UsePlayerControllerReturn {
104
+ /** Container ref to attach to your player container div */
105
+ containerRef: React.RefObject<HTMLDivElement | null>;
106
+ /** Current state (reactive) */
107
+ state: PlayerControllerState;
108
+ /** Controller instance (for direct method calls) */
109
+ controller: PlayerController | null;
110
+ /** Play */
111
+ play: () => Promise<void>;
112
+ /** Pause */
113
+ pause: () => void;
114
+ /** Toggle play/pause */
115
+ togglePlay: () => void;
116
+ /** Seek to time */
117
+ seek: (time: number) => void;
118
+ /** Seek by delta */
119
+ seekBy: (delta: number) => void;
120
+ /** Set volume */
121
+ setVolume: (volume: number) => void;
122
+ /** Toggle mute */
123
+ toggleMute: () => void;
124
+ /** Toggle loop */
125
+ toggleLoop: () => void;
126
+ /** Toggle fullscreen */
127
+ toggleFullscreen: () => Promise<void>;
128
+ /** Toggle PiP */
129
+ togglePiP: () => Promise<void>;
130
+ /** Toggle subtitles */
131
+ toggleSubtitles: () => void;
132
+ /** Clear error */
133
+ clearError: () => void;
134
+ /** Retry playback */
135
+ retry: () => Promise<void>;
136
+ /** Reload player */
137
+ reload: () => Promise<void>;
138
+ /** Get qualities */
139
+ getQualities: () => Array<{
140
+ id: string;
141
+ label: string;
142
+ bitrate?: number;
143
+ }>;
144
+ /** Select quality */
145
+ selectQuality: (id: string) => void;
146
+ /** Handle mouse enter (for controls visibility) */
147
+ handleMouseEnter: () => void;
148
+ /** Handle mouse leave (for controls visibility) */
149
+ handleMouseLeave: () => void;
150
+ /** Handle mouse move (for controls visibility) */
151
+ handleMouseMove: () => void;
152
+ /** Handle touch start (for controls visibility) */
153
+ handleTouchStart: () => void;
154
+ /** Set dev mode options (force player, type, source) */
155
+ setDevModeOptions: (options: {
156
+ forcePlayer?: string;
157
+ forceType?: string;
158
+ forceSource?: number;
159
+ playbackMode?: 'auto' | 'low-latency' | 'quality' | 'vod';
160
+ }) => Promise<void>;
161
+ }
162
+ export declare function usePlayerController(config: UsePlayerControllerConfig): UsePlayerControllerReturn;
163
+ export default usePlayerController;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * usePlayerSelection
3
+ *
4
+ * React hook for subscribing to PlayerManager selection events.
5
+ * Uses event-driven updates instead of polling - no render spam.
6
+ */
7
+ import type { PlayerManager, PlayerSelection, PlayerCombination, StreamInfo, PlaybackMode } from '@livepeer-frameworks/player-core';
8
+ export interface UsePlayerSelectionOptions {
9
+ /** Stream info to compute selections for */
10
+ streamInfo: StreamInfo | null;
11
+ /** Playback mode override */
12
+ playbackMode?: PlaybackMode;
13
+ /** Enable debug logging */
14
+ debug?: boolean;
15
+ }
16
+ export interface UsePlayerSelectionReturn {
17
+ /** Current best selection (null if no compatible player) */
18
+ selection: PlayerSelection | null;
19
+ /** All player+source combinations with scores */
20
+ combinations: PlayerCombination[];
21
+ /** Whether initial computation has completed */
22
+ ready: boolean;
23
+ /** Force recomputation (invalidates cache) */
24
+ refresh: () => void;
25
+ }
26
+ /**
27
+ * Subscribe to player selection changes from a PlayerManager.
28
+ *
29
+ * This hook uses the event system in PlayerManager, which means:
30
+ * - Initial computation happens once when streamInfo is provided
31
+ * - Updates only fire when selection actually changes (different player+source)
32
+ * - No render spam from React strict mode or frequent re-renders
33
+ *
34
+ * @example
35
+ * ```tsx
36
+ * const { selection, combinations, ready } = usePlayerSelection(globalPlayerManager, {
37
+ * streamInfo,
38
+ * playbackMode: 'auto',
39
+ * });
40
+ *
41
+ * if (!ready) return <Loading />;
42
+ * if (!selection) return <NoPlayerAvailable />;
43
+ *
44
+ * return <div>Selected: {selection.player} + {selection.source.type}</div>;
45
+ * ```
46
+ */
47
+ export declare function usePlayerSelection(manager: PlayerManager, options: UsePlayerSelectionOptions): UsePlayerSelectionReturn;
@@ -0,0 +1,27 @@
1
+ import type { UseStreamStateOptions, StreamState } from '../types';
2
+ /**
3
+ * Hook to poll MistServer for stream status via WebSocket or HTTP
4
+ *
5
+ * Uses native MistServer protocol:
6
+ * - WebSocket: ws://{baseUrl}/json_{streamName}.js
7
+ * - HTTP fallback: GET {baseUrl}/json_{streamName}.js
8
+ *
9
+ * @example
10
+ * ```tsx
11
+ * const { status, isOnline, message } = useStreamState({
12
+ * mistBaseUrl: 'https://mist.example.com',
13
+ * streamName: 'my-stream',
14
+ * pollInterval: 3000,
15
+ * });
16
+ * ```
17
+ */
18
+ export interface UseStreamStateReturn extends StreamState {
19
+ /** Manual refetch function */
20
+ refetch: () => void;
21
+ /** WebSocket reference for sharing with MistReporter */
22
+ socketRef: React.RefObject<WebSocket | null>;
23
+ /** True when WebSocket is connected and ready (triggers re-render) */
24
+ socketReady: boolean;
25
+ }
26
+ export declare function useStreamState(options: UseStreamStateOptions): UseStreamStateReturn;
27
+ export default useStreamState;
@@ -0,0 +1,57 @@
1
+ import { type TelemetryOptions, type PlaybackQuality, type ContentType } from '@livepeer-frameworks/player-core';
2
+ export interface UseTelemetryOptions extends TelemetryOptions {
3
+ /** Video element to monitor */
4
+ videoElement: HTMLVideoElement | null;
5
+ /** Content ID being played */
6
+ contentId: string;
7
+ /** Content type */
8
+ contentType: ContentType;
9
+ /** Player type name */
10
+ playerType: string;
11
+ /** Protocol being used */
12
+ protocol: string;
13
+ /** Optional quality getter function */
14
+ getQuality?: () => PlaybackQuality | null;
15
+ }
16
+ /**
17
+ * Hook to send telemetry data to a server
18
+ *
19
+ * Reports playback metrics at configurable intervals:
20
+ * - Current time and duration
21
+ * - Buffer health
22
+ * - Stall count and duration
23
+ * - Quality score and bitrate
24
+ * - Frame decode/drop stats
25
+ * - Errors encountered
26
+ *
27
+ * Uses navigator.sendBeacon() for reliable reporting on page unload.
28
+ *
29
+ * @example
30
+ * ```tsx
31
+ * const { sessionId, recordError } = useTelemetry({
32
+ * enabled: true,
33
+ * endpoint: '/api/telemetry',
34
+ * interval: 5000,
35
+ * videoElement,
36
+ * contentId: 'my-stream',
37
+ * contentType: 'live',
38
+ * playerType: 'hlsjs',
39
+ * protocol: 'HLS',
40
+ * getQuality: () => qualityMonitor.getCurrentQuality(),
41
+ * });
42
+ *
43
+ * // Record custom error
44
+ * recordError('NETWORK_ERROR', 'Connection lost');
45
+ * ```
46
+ */
47
+ export declare function useTelemetry(options: UseTelemetryOptions): {
48
+ /** Session ID for this playback session */
49
+ sessionId: string | null;
50
+ /** Record a custom error */
51
+ recordError: (code: string, message: string) => void;
52
+ /** Get current session ID */
53
+ getSessionId: () => string | null;
54
+ /** Check if telemetry is active */
55
+ isActive: () => boolean;
56
+ };
57
+ export default useTelemetry;
@@ -0,0 +1,14 @@
1
+ import type { ContentType } from '@livepeer-frameworks/player-core';
2
+ import type { ContentEndpoints } from '../types';
3
+ interface Params {
4
+ gatewayUrl: string;
5
+ contentType: ContentType;
6
+ contentId: string;
7
+ authToken?: string;
8
+ }
9
+ export declare function useViewerEndpoints({ gatewayUrl, contentType, contentId, authToken }: Params): {
10
+ endpoints: ContentEndpoints | null;
11
+ status: "error" | "ready" | "idle" | "loading";
12
+ error: string | null;
13
+ };
14
+ export default useViewerEndpoints;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @livepeer-frameworks/player-react
3
+ *
4
+ * React components for FrameWorks streaming player.
5
+ */
6
+ export { default as Player } from './components/Player';
7
+ export { default as PlayerControls } from './components/PlayerControls';
8
+ export { default as LoadingScreen } from './components/LoadingScreen';
9
+ export { default as IdleScreen } from './components/IdleScreen';
10
+ export { default as ThumbnailOverlay } from './components/ThumbnailOverlay';
11
+ export { default as TitleOverlay } from './components/TitleOverlay';
12
+ export { default as StreamStateOverlay } from './components/StreamStateOverlay';
13
+ export { default as StatsPanel } from './components/StatsPanel';
14
+ export { default as DevModePanel } from './components/DevModePanel';
15
+ export { default as PlayerErrorBoundary } from './components/PlayerErrorBoundary';
16
+ export * from './components/Icons';
17
+ export { Button } from './ui/button';
18
+ export { Badge } from './ui/badge';
19
+ export { Slider } from './ui/slider';
20
+ export { PlayerProvider, usePlayerContext, usePlayerContextOptional, PlayerContext } from './context/PlayerContext';
21
+ export type { PlayerContextValue } from './context/PlayerContext';
22
+ export { useStreamState } from './hooks/useStreamState';
23
+ export { usePlaybackQuality } from './hooks/usePlaybackQuality';
24
+ export { useViewerEndpoints } from './hooks/useViewerEndpoints';
25
+ export { useMetaTrack } from './hooks/useMetaTrack';
26
+ export { useTelemetry } from './hooks/useTelemetry';
27
+ export { usePlayerSelection } from './hooks/usePlayerSelection';
28
+ export type { UsePlayerSelectionOptions, UsePlayerSelectionReturn } from './hooks/usePlayerSelection';
29
+ export { usePlayerController } from './hooks/usePlayerController';
30
+ export type { UsePlayerControllerConfig, UsePlayerControllerReturn, PlayerControllerState, } from './hooks/usePlayerController';
31
+ export * from './types';
32
+ export { PlayerManager, globalPlayerManager, PlayerController, GatewayClient, StreamStateClient, QualityMonitor, cn, } from '@livepeer-frameworks/player-core';
33
+ export type { PlayerState, PlayerStateContext, StreamState, StreamStatus, MistStreamInfo, PlaybackQuality, PlaybackMode, ContentEndpoints, EndpointInfo, PlayerSelection, PlayerCombination, PlayerManagerEvents, } from '@livepeer-frameworks/player-core';
@@ -0,0 +1,94 @@
1
+ /**
2
+ * React-specific types for FrameWorks player
3
+ */
4
+ import type React from 'react';
5
+ import type { PlayerOptions, PlayerState, PlayerStateContext, ContentEndpoints, MetaTrackSubscription, PlaybackQuality, QualityThresholds, ContentType } from '@livepeer-frameworks/player-core';
6
+ export interface PlayerProps {
7
+ /** Content identifier or stream name */
8
+ contentId: string;
9
+ /** Content type */
10
+ contentType: ContentType;
11
+ /** Pre-resolved endpoints/capabilities from Gateway/Foghorn */
12
+ endpoints?: ContentEndpoints;
13
+ /** Optional thumbnail/poster image */
14
+ thumbnailUrl?: string | null;
15
+ /** Unified options (branding, playback prefs, etc.) */
16
+ options?: Partial<PlayerOptions>;
17
+ /** Detailed state updates for UI (booting, gateway, connecting, playing, etc.) */
18
+ onStateChange?: (state: PlayerState, context?: PlayerStateContext) => void;
19
+ }
20
+ export interface MistPlayerProps {
21
+ streamName: string;
22
+ htmlUrl?: string;
23
+ playerJsUrl?: string;
24
+ developmentMode?: boolean;
25
+ muted?: boolean;
26
+ poster?: string;
27
+ }
28
+ export interface LoadingScreenProps {
29
+ message?: string;
30
+ }
31
+ export interface ThumbnailOverlayProps {
32
+ thumbnailUrl?: string | null | undefined;
33
+ onPlay?: () => void;
34
+ message?: string | null;
35
+ showUnmuteMessage?: boolean;
36
+ style?: React.CSSProperties;
37
+ className?: string;
38
+ }
39
+ export interface AnimatedBubbleProps {
40
+ index: number;
41
+ }
42
+ export interface CenterLogoProps {
43
+ containerRef: React.RefObject<HTMLDivElement>;
44
+ scale?: number;
45
+ onHitmarker?: (event: React.MouseEvent) => void;
46
+ }
47
+ export interface HitmarkerData {
48
+ id: number;
49
+ x: number;
50
+ y: number;
51
+ }
52
+ export interface DvdLogoProps {
53
+ parentRef: React.RefObject<HTMLDivElement>;
54
+ scale?: number;
55
+ }
56
+ export interface UsePlaybackQualityOptions {
57
+ videoElement: HTMLVideoElement | null;
58
+ enabled?: boolean;
59
+ sampleInterval?: number;
60
+ thresholds?: Partial<QualityThresholds>;
61
+ onQualityDegraded?: (quality: PlaybackQuality) => void;
62
+ }
63
+ export interface UseMetaTrackOptions {
64
+ mistBaseUrl: string;
65
+ streamName: string;
66
+ enabled?: boolean;
67
+ subscriptions?: MetaTrackSubscription[];
68
+ }
69
+ export interface UseStreamStateOptions {
70
+ /** MistServer base URL */
71
+ mistBaseUrl: string;
72
+ /** Stream name */
73
+ streamName: string;
74
+ /** Poll interval in ms (default: 3000) */
75
+ pollInterval?: number;
76
+ /** Enable/disable the hook (default: true) */
77
+ enabled?: boolean;
78
+ /** Use WebSocket instead of HTTP polling (default: true) */
79
+ useWebSocket?: boolean;
80
+ /** Enable debug logging (default: false) */
81
+ debug?: boolean;
82
+ }
83
+ export interface UseTelemetryOptions {
84
+ enabled?: boolean;
85
+ endpoint?: string;
86
+ authToken?: string;
87
+ interval?: number;
88
+ batchSize?: number;
89
+ contentId?: string;
90
+ contentType?: string;
91
+ playerType?: string;
92
+ protocol?: string;
93
+ }
94
+ export type { PlayerState, PlayerStateContext, ContentEndpoints, PlayerOptions, PlaybackQuality, TelemetryOptions, TelemetryPayload, MetaTrackEvent, MetaTrackEventType, SubtitleCue, PlaybackMode, MistStreamInfo, StreamState, StreamStatus, EndpointInfo, ContentMetadata, } from '@livepeer-frameworks/player-core';
@@ -0,0 +1,9 @@
1
+ import * as React from "react";
2
+ import { type VariantProps } from "class-variance-authority";
3
+ declare const badgeVariants: (props?: ({
4
+ variant?: "default" | "secondary" | "outline" | null | undefined;
5
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
6
+ export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
7
+ }
8
+ declare function Badge({ className, variant, ...props }: BadgeProps): import("react/jsx-runtime").JSX.Element;
9
+ export { Badge, badgeVariants };
@@ -0,0 +1,11 @@
1
+ import * as React from "react";
2
+ import { type VariantProps } from "class-variance-authority";
3
+ declare const buttonVariants: (props?: ({
4
+ variant?: "link" | "default" | "secondary" | "ghost" | "outline" | "destructive" | "subtle" | null | undefined;
5
+ size?: "default" | "sm" | "lg" | "icon" | null | undefined;
6
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
+ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
8
+ asChild?: boolean;
9
+ }
10
+ declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
11
+ export { Button, buttonVariants };
@@ -0,0 +1,27 @@
1
+ import * as React from "react";
2
+ import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
3
+ declare const ContextMenu: React.FC<ContextMenuPrimitive.ContextMenuProps>;
4
+ declare const ContextMenuTrigger: React.ForwardRefExoticComponent<ContextMenuPrimitive.ContextMenuTriggerProps & React.RefAttributes<HTMLSpanElement>>;
5
+ declare const ContextMenuGroup: React.ForwardRefExoticComponent<ContextMenuPrimitive.ContextMenuGroupProps & React.RefAttributes<HTMLDivElement>>;
6
+ declare const ContextMenuPortal: React.FC<ContextMenuPrimitive.ContextMenuPortalProps>;
7
+ declare const ContextMenuSub: React.FC<ContextMenuPrimitive.ContextMenuSubProps>;
8
+ declare const ContextMenuRadioGroup: React.ForwardRefExoticComponent<ContextMenuPrimitive.ContextMenuRadioGroupProps & React.RefAttributes<HTMLDivElement>>;
9
+ declare const ContextMenuSubTrigger: React.ForwardRefExoticComponent<Omit<ContextMenuPrimitive.ContextMenuSubTriggerProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
10
+ inset?: boolean;
11
+ } & React.RefAttributes<HTMLDivElement>>;
12
+ declare const ContextMenuSubContent: React.ForwardRefExoticComponent<Omit<ContextMenuPrimitive.ContextMenuSubContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
13
+ declare const ContextMenuContent: React.ForwardRefExoticComponent<Omit<ContextMenuPrimitive.ContextMenuContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
14
+ declare const ContextMenuItem: React.ForwardRefExoticComponent<Omit<ContextMenuPrimitive.ContextMenuItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
15
+ inset?: boolean;
16
+ } & React.RefAttributes<HTMLDivElement>>;
17
+ declare const ContextMenuCheckboxItem: React.ForwardRefExoticComponent<Omit<ContextMenuPrimitive.ContextMenuCheckboxItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
18
+ declare const ContextMenuRadioItem: React.ForwardRefExoticComponent<Omit<ContextMenuPrimitive.ContextMenuRadioItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
19
+ declare const ContextMenuLabel: React.ForwardRefExoticComponent<Omit<ContextMenuPrimitive.ContextMenuLabelProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
20
+ inset?: boolean;
21
+ } & React.RefAttributes<HTMLDivElement>>;
22
+ declare const ContextMenuSeparator: React.ForwardRefExoticComponent<Omit<ContextMenuPrimitive.ContextMenuSeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
23
+ declare const ContextMenuShortcut: {
24
+ ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>): import("react/jsx-runtime").JSX.Element;
25
+ displayName: string;
26
+ };
27
+ export { ContextMenu, ContextMenuTrigger, ContextMenuContent, ContextMenuItem, ContextMenuCheckboxItem, ContextMenuRadioItem, ContextMenuLabel, ContextMenuSeparator, ContextMenuShortcut, ContextMenuGroup, ContextMenuPortal, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuRadioGroup, };
@@ -0,0 +1,10 @@
1
+ import * as SelectPrimitive from "@radix-ui/react-select";
2
+ import * as React from "react";
3
+ declare const Select: React.FC<SelectPrimitive.SelectProps>;
4
+ declare const SelectValue: React.ForwardRefExoticComponent<SelectPrimitive.SelectValueProps & React.RefAttributes<HTMLSpanElement>>;
5
+ declare const SelectTrigger: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
6
+ declare const SelectContent: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
7
+ declare const SelectItem: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
8
+ declare const SelectLabel: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectLabelProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
9
+ declare const SelectSeparator: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectSeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
10
+ export { Select, SelectContent, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue };
@@ -0,0 +1,13 @@
1
+ import * as React from "react";
2
+ import * as SliderPrimitive from "@radix-ui/react-slider";
3
+ export interface SliderProps extends React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root> {
4
+ showTrack?: boolean;
5
+ trackClassName?: string;
6
+ thumbClassName?: string;
7
+ /** Show thumb only on hover (YouTube-style) - but always shows a smaller thumb when not hovered */
8
+ hoverThumb?: boolean;
9
+ /** Use cyan accent color (matches SeekBar styling) */
10
+ accentColor?: boolean;
11
+ }
12
+ declare const Slider: React.ForwardRefExoticComponent<SliderProps & React.RefAttributes<HTMLSpanElement>>;
13
+ export { Slider };