@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.
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/types/components/DevModePanel.d.ts +47 -0
- package/dist/types/components/DvdLogo.d.ts +4 -0
- package/dist/types/components/Icons.d.ts +33 -0
- package/dist/types/components/IdleScreen.d.ts +16 -0
- package/dist/types/components/LoadingScreen.d.ts +6 -0
- package/dist/types/components/LogoOverlay.d.ts +11 -0
- package/dist/types/components/Player.d.ts +11 -0
- package/dist/types/components/PlayerControls.d.ts +60 -0
- package/dist/types/components/PlayerErrorBoundary.d.ts +23 -0
- package/dist/types/components/SeekBar.d.ts +33 -0
- package/dist/types/components/SkipIndicator.d.ts +14 -0
- package/dist/types/components/SpeedIndicator.d.ts +12 -0
- package/dist/types/components/StatsPanel.d.ts +31 -0
- package/dist/types/components/StreamStateOverlay.d.ts +24 -0
- package/dist/types/components/SubtitleRenderer.d.ts +69 -0
- package/dist/types/components/ThumbnailOverlay.d.ts +4 -0
- package/dist/types/components/TitleOverlay.d.ts +13 -0
- package/dist/types/components/players/DashJsPlayer.d.ts +18 -0
- package/dist/types/components/players/HlsJsPlayer.d.ts +18 -0
- package/dist/types/components/players/MewsWsPlayer/index.d.ts +18 -0
- package/dist/types/components/players/MistPlayer.d.ts +20 -0
- package/dist/types/components/players/MistWebRTCPlayer/index.d.ts +20 -0
- package/dist/types/components/players/NativePlayer.d.ts +19 -0
- package/dist/types/components/players/VideoJsPlayer.d.ts +18 -0
- package/dist/types/context/PlayerContext.d.ts +40 -0
- package/dist/types/context/index.d.ts +5 -0
- package/dist/types/hooks/useMetaTrack.d.ts +54 -0
- package/dist/types/hooks/usePlaybackQuality.d.ts +42 -0
- package/dist/types/hooks/usePlayerController.d.ts +163 -0
- package/dist/types/hooks/usePlayerSelection.d.ts +47 -0
- package/dist/types/hooks/useStreamState.d.ts +27 -0
- package/dist/types/hooks/useTelemetry.d.ts +57 -0
- package/dist/types/hooks/useViewerEndpoints.d.ts +14 -0
- package/dist/types/index.d.ts +33 -0
- package/dist/types/types.d.ts +94 -0
- package/dist/types/ui/badge.d.ts +9 -0
- package/dist/types/ui/button.d.ts +11 -0
- package/dist/types/ui/context-menu.d.ts +27 -0
- package/dist/types/ui/select.d.ts +10 -0
- package/dist/types/ui/slider.d.ts +13 -0
- package/package.json +71 -0
- package/src/assets/logomark.svg +56 -0
- package/src/components/DevModePanel.tsx +822 -0
- package/src/components/DvdLogo.tsx +201 -0
- package/src/components/Icons.tsx +282 -0
- package/src/components/IdleScreen.tsx +664 -0
- package/src/components/LoadingScreen.tsx +710 -0
- package/src/components/LogoOverlay.tsx +75 -0
- package/src/components/Player.tsx +419 -0
- package/src/components/PlayerControls.tsx +820 -0
- package/src/components/PlayerErrorBoundary.tsx +70 -0
- package/src/components/SeekBar.tsx +291 -0
- package/src/components/SkipIndicator.tsx +113 -0
- package/src/components/SpeedIndicator.tsx +57 -0
- package/src/components/StatsPanel.tsx +150 -0
- package/src/components/StreamStateOverlay.tsx +200 -0
- package/src/components/SubtitleRenderer.tsx +235 -0
- package/src/components/ThumbnailOverlay.tsx +90 -0
- package/src/components/TitleOverlay.tsx +48 -0
- package/src/components/players/DashJsPlayer.tsx +56 -0
- package/src/components/players/HlsJsPlayer.tsx +56 -0
- package/src/components/players/MewsWsPlayer/index.tsx +56 -0
- package/src/components/players/MistPlayer.tsx +60 -0
- package/src/components/players/MistWebRTCPlayer/index.tsx +59 -0
- package/src/components/players/NativePlayer.tsx +58 -0
- package/src/components/players/VideoJsPlayer.tsx +56 -0
- package/src/context/PlayerContext.tsx +71 -0
- package/src/context/index.ts +11 -0
- package/src/global.d.ts +4 -0
- package/src/hooks/useMetaTrack.ts +187 -0
- package/src/hooks/usePlaybackQuality.ts +126 -0
- package/src/hooks/usePlayerController.ts +525 -0
- package/src/hooks/usePlayerSelection.ts +117 -0
- package/src/hooks/useStreamState.ts +381 -0
- package/src/hooks/useTelemetry.ts +138 -0
- package/src/hooks/useViewerEndpoints.ts +120 -0
- package/src/index.tsx +75 -0
- package/src/player.css +2 -0
- package/src/types.ts +135 -0
- package/src/ui/badge.tsx +27 -0
- package/src/ui/button.tsx +47 -0
- package/src/ui/context-menu.tsx +193 -0
- package/src/ui/select.tsx +105 -0
- package/src/ui/slider.tsx +67 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type StreamInfo, type MistStreamInfo, type PlaybackMode } from "@livepeer-frameworks/player-core";
|
|
3
|
+
export interface DevModePanelProps {
|
|
4
|
+
/** Callback when user selects a combo (one-shot selection) */
|
|
5
|
+
onSettingsChange: (settings: {
|
|
6
|
+
forcePlayer?: string;
|
|
7
|
+
forceType?: string;
|
|
8
|
+
forceSource?: number;
|
|
9
|
+
}) => void;
|
|
10
|
+
/** Current playback mode */
|
|
11
|
+
playbackMode?: PlaybackMode;
|
|
12
|
+
/** Callback when playback mode changes */
|
|
13
|
+
onModeChange?: (mode: PlaybackMode) => void;
|
|
14
|
+
/** Callback to force player reload */
|
|
15
|
+
onReload?: () => void;
|
|
16
|
+
/** Stream info for getting all combinations (sources + tracks from MistServer) */
|
|
17
|
+
streamInfo?: StreamInfo | null;
|
|
18
|
+
/** MistServer stream metadata including tracks */
|
|
19
|
+
mistStreamInfo?: MistStreamInfo | null;
|
|
20
|
+
/** Current player info */
|
|
21
|
+
currentPlayer?: {
|
|
22
|
+
name: string;
|
|
23
|
+
shortname: string;
|
|
24
|
+
} | null;
|
|
25
|
+
/** Current source info */
|
|
26
|
+
currentSource?: {
|
|
27
|
+
url: string;
|
|
28
|
+
type: string;
|
|
29
|
+
} | null;
|
|
30
|
+
/** Video element for stats */
|
|
31
|
+
videoElement?: HTMLVideoElement | null;
|
|
32
|
+
/** Protocol/node info */
|
|
33
|
+
protocol?: string;
|
|
34
|
+
nodeId?: string;
|
|
35
|
+
/** Whether the panel toggle is visible (hover state) */
|
|
36
|
+
isVisible?: boolean;
|
|
37
|
+
/** Controlled open state (if provided, component is controlled) */
|
|
38
|
+
isOpen?: boolean;
|
|
39
|
+
/** Callback when open state changes */
|
|
40
|
+
onOpenChange?: (isOpen: boolean) => void;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* DevModePanel - Advanced Settings overlay for testing player configurations
|
|
44
|
+
* Similar to MistPlayer's skin: "dev" mode
|
|
45
|
+
*/
|
|
46
|
+
declare const DevModePanel: React.FC<DevModePanelProps>;
|
|
47
|
+
export default DevModePanel;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface IconProps {
|
|
3
|
+
size?: number;
|
|
4
|
+
color?: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const PlayIcon: React.FC<IconProps>;
|
|
8
|
+
export declare const PauseIcon: React.FC<IconProps>;
|
|
9
|
+
export declare const SkipBackIcon: React.FC<IconProps>;
|
|
10
|
+
export declare const SkipForwardIcon: React.FC<IconProps>;
|
|
11
|
+
export declare const VolumeUpIcon: React.FC<IconProps>;
|
|
12
|
+
export declare const VolumeOffIcon: React.FC<IconProps>;
|
|
13
|
+
export declare const FullscreenIcon: React.FC<IconProps>;
|
|
14
|
+
export declare const FullscreenExitIcon: React.FC<IconProps>;
|
|
15
|
+
export declare const PictureInPictureIcon: React.FC<IconProps>;
|
|
16
|
+
export declare const ClosedCaptionsIcon: React.FC<IconProps>;
|
|
17
|
+
export declare const LiveIcon: React.FC<IconProps>;
|
|
18
|
+
export declare const SettingsIcon: React.FC<IconProps>;
|
|
19
|
+
interface PlayPauseIconProps extends IconProps {
|
|
20
|
+
isPlaying?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export declare const PlayPauseIcon: React.FC<PlayPauseIconProps>;
|
|
23
|
+
interface VolumeIconProps extends IconProps {
|
|
24
|
+
isMuted?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export declare const VolumeIcon: React.FC<VolumeIconProps>;
|
|
27
|
+
interface FullscreenToggleIconProps extends IconProps {
|
|
28
|
+
isFullscreen?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export declare const FullscreenToggleIcon: React.FC<FullscreenToggleIconProps>;
|
|
31
|
+
export declare const StatsIcon: React.FC<IconProps>;
|
|
32
|
+
export declare const SeekToLiveIcon: React.FC<IconProps>;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { StreamStatus } from "../types";
|
|
3
|
+
export interface IdleScreenProps {
|
|
4
|
+
/** Stream status (OFFLINE, INITIALIZING, ERROR, etc.) */
|
|
5
|
+
status?: StreamStatus;
|
|
6
|
+
/** Human-readable message */
|
|
7
|
+
message?: string;
|
|
8
|
+
/** Processing percentage (for INITIALIZING) */
|
|
9
|
+
percentage?: number;
|
|
10
|
+
/** Error message */
|
|
11
|
+
error?: string;
|
|
12
|
+
/** Callback for retry button */
|
|
13
|
+
onRetry?: () => void;
|
|
14
|
+
}
|
|
15
|
+
export declare const IdleScreen: React.FC<IdleScreenProps>;
|
|
16
|
+
export default IdleScreen;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface LogoOverlayProps {
|
|
3
|
+
src: string;
|
|
4
|
+
show?: boolean;
|
|
5
|
+
position?: "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
6
|
+
width?: number;
|
|
7
|
+
height?: number | "auto";
|
|
8
|
+
clickUrl?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const LogoOverlay: React.FC<LogoOverlayProps>;
|
|
11
|
+
export default LogoOverlay;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { PlayerProps } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* Main Player component.
|
|
5
|
+
*
|
|
6
|
+
* Note: PlayerProvider is available if you need to use context-based access
|
|
7
|
+
* across multiple components. PlayerInner manages its own PlayerController
|
|
8
|
+
* via usePlayerController hook.
|
|
9
|
+
*/
|
|
10
|
+
declare const Player: React.FC<PlayerProps>;
|
|
11
|
+
export default Player;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { MistStreamInfo, PlaybackMode } from "../types";
|
|
3
|
+
interface PlayerControlsProps {
|
|
4
|
+
currentTime: number;
|
|
5
|
+
duration: number;
|
|
6
|
+
isVisible?: boolean;
|
|
7
|
+
className?: string;
|
|
8
|
+
onSeek?: (time: number) => void;
|
|
9
|
+
showStatsButton?: boolean;
|
|
10
|
+
isStatsOpen?: boolean;
|
|
11
|
+
onStatsToggle?: () => void;
|
|
12
|
+
/** Live MistServer stream info - drives control visibility based on server metadata */
|
|
13
|
+
mistStreamInfo?: MistStreamInfo;
|
|
14
|
+
/** Disable all controls (e.g., while player is initializing) */
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
/** Current playback mode */
|
|
17
|
+
playbackMode?: PlaybackMode;
|
|
18
|
+
/** Callback when playback mode changes */
|
|
19
|
+
onModeChange?: (mode: PlaybackMode) => void;
|
|
20
|
+
/** Current source protocol type (e.g., 'whep', 'ws/video/mp4', 'html5/application/vnd.apple.mpegurl') */
|
|
21
|
+
sourceType?: string;
|
|
22
|
+
/** Content-type based live flag (for mode selector visibility, separate from seek bar isLive) */
|
|
23
|
+
isContentLive?: boolean;
|
|
24
|
+
/** Video element - passed from parent hook */
|
|
25
|
+
videoElement?: HTMLVideoElement | null;
|
|
26
|
+
/** Available quality levels - passed from parent hook */
|
|
27
|
+
qualities?: Array<{
|
|
28
|
+
id: string;
|
|
29
|
+
label: string;
|
|
30
|
+
bitrate?: number;
|
|
31
|
+
width?: number;
|
|
32
|
+
height?: number;
|
|
33
|
+
isAuto?: boolean;
|
|
34
|
+
active?: boolean;
|
|
35
|
+
}>;
|
|
36
|
+
/** Callback to select quality */
|
|
37
|
+
onSelectQuality?: (id: string) => void;
|
|
38
|
+
/** Is player muted */
|
|
39
|
+
isMuted?: boolean;
|
|
40
|
+
/** Current volume (0-1) */
|
|
41
|
+
volume?: number;
|
|
42
|
+
/** Callback for volume change */
|
|
43
|
+
onVolumeChange?: (volume: number) => void;
|
|
44
|
+
/** Toggle mute callback */
|
|
45
|
+
onToggleMute?: () => void;
|
|
46
|
+
/** Is playing */
|
|
47
|
+
isPlaying?: boolean;
|
|
48
|
+
/** Toggle play/pause callback */
|
|
49
|
+
onTogglePlay?: () => void;
|
|
50
|
+
/** Toggle fullscreen callback */
|
|
51
|
+
onToggleFullscreen?: () => void;
|
|
52
|
+
/** Is fullscreen */
|
|
53
|
+
isFullscreen?: boolean;
|
|
54
|
+
/** Is loop enabled */
|
|
55
|
+
isLoopEnabled?: boolean;
|
|
56
|
+
/** Toggle loop callback */
|
|
57
|
+
onToggleLoop?: () => void;
|
|
58
|
+
}
|
|
59
|
+
declare const PlayerControls: React.FC<PlayerControlsProps>;
|
|
60
|
+
export default PlayerControls;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Component, ErrorInfo, ReactNode } from 'react';
|
|
2
|
+
interface Props {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
fallback?: ReactNode;
|
|
5
|
+
onError?: (error: Error, errorInfo: ErrorInfo) => void;
|
|
6
|
+
onRetry?: () => void;
|
|
7
|
+
}
|
|
8
|
+
interface State {
|
|
9
|
+
hasError: boolean;
|
|
10
|
+
error: Error | null;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Error boundary to catch and handle player errors gracefully.
|
|
14
|
+
* Prevents player errors from crashing the parent application.
|
|
15
|
+
*/
|
|
16
|
+
declare class PlayerErrorBoundary extends Component<Props, State> {
|
|
17
|
+
constructor(props: Props);
|
|
18
|
+
static getDerivedStateFromError(error: Error): State;
|
|
19
|
+
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
20
|
+
handleRetry: () => void;
|
|
21
|
+
render(): ReactNode;
|
|
22
|
+
}
|
|
23
|
+
export default PlayerErrorBoundary;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface SeekBarProps {
|
|
3
|
+
/** Current playback time in seconds */
|
|
4
|
+
currentTime: number;
|
|
5
|
+
/** Total duration in seconds */
|
|
6
|
+
duration: number;
|
|
7
|
+
/** Buffered time ranges from video element */
|
|
8
|
+
buffered?: TimeRanges;
|
|
9
|
+
/** Whether seeking is allowed */
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
/** Called when user seeks to a new time */
|
|
12
|
+
onSeek?: (time: number) => void;
|
|
13
|
+
/** Additional class names */
|
|
14
|
+
className?: string;
|
|
15
|
+
/** Whether this is a live stream */
|
|
16
|
+
isLive?: boolean;
|
|
17
|
+
/** For live: start of seekable DVR window (seconds) */
|
|
18
|
+
seekableStart?: number;
|
|
19
|
+
/** For live: current live edge position (seconds) */
|
|
20
|
+
liveEdge?: number;
|
|
21
|
+
/** Defer seeking until drag release */
|
|
22
|
+
commitOnRelease?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Industry-standard video seek bar with:
|
|
26
|
+
* - Track background
|
|
27
|
+
* - Buffer progress indicator
|
|
28
|
+
* - Playback progress indicator
|
|
29
|
+
* - Thumb on hover
|
|
30
|
+
* - Time tooltip on hover (relative for live: "-5:30")
|
|
31
|
+
*/
|
|
32
|
+
declare const SeekBar: React.FC<SeekBarProps>;
|
|
33
|
+
export default SeekBar;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export type SkipDirection = "back" | "forward" | null;
|
|
3
|
+
interface SkipIndicatorProps {
|
|
4
|
+
direction: SkipDirection;
|
|
5
|
+
seconds?: number;
|
|
6
|
+
className?: string;
|
|
7
|
+
onHide?: () => void;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Skip indicator overlay that appears when double-tapping to skip.
|
|
11
|
+
* Shows the skip direction and amount (e.g., "-10s" or "+10s") with a ripple effect.
|
|
12
|
+
*/
|
|
13
|
+
declare const SkipIndicator: React.FC<SkipIndicatorProps>;
|
|
14
|
+
export default SkipIndicator;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface SpeedIndicatorProps {
|
|
3
|
+
isVisible: boolean;
|
|
4
|
+
speed: number;
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Speed indicator overlay that appears when holding for fast-forward.
|
|
9
|
+
* Shows the current playback speed (e.g., "2x") in a pill overlay.
|
|
10
|
+
*/
|
|
11
|
+
declare const SpeedIndicator: React.FC<SpeedIndicatorProps>;
|
|
12
|
+
export default SpeedIndicator;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type ContentMetadata, type PlaybackQuality } from "@livepeer-frameworks/player-core";
|
|
3
|
+
interface StreamStateInfo {
|
|
4
|
+
status?: string;
|
|
5
|
+
viewers?: number;
|
|
6
|
+
tracks?: Array<{
|
|
7
|
+
type: string;
|
|
8
|
+
codec: string;
|
|
9
|
+
width?: number;
|
|
10
|
+
height?: number;
|
|
11
|
+
bps?: number;
|
|
12
|
+
channels?: number;
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
15
|
+
interface StatsPanelProps {
|
|
16
|
+
isOpen: boolean;
|
|
17
|
+
onClose: () => void;
|
|
18
|
+
metadata?: ContentMetadata | null;
|
|
19
|
+
streamState?: StreamStateInfo | null;
|
|
20
|
+
quality?: PlaybackQuality | null;
|
|
21
|
+
videoElement?: HTMLVideoElement | null;
|
|
22
|
+
protocol?: string;
|
|
23
|
+
nodeId?: string;
|
|
24
|
+
geoDistance?: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* "Stats for nerds" panel showing detailed playback information.
|
|
28
|
+
* Toggleable overlay with technical details about the stream.
|
|
29
|
+
*/
|
|
30
|
+
declare const StatsPanel: React.FC<StatsPanelProps>;
|
|
31
|
+
export default StatsPanel;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { StreamStatus } from '../types';
|
|
3
|
+
export interface StreamStateOverlayProps {
|
|
4
|
+
/** Current stream status */
|
|
5
|
+
status: StreamStatus;
|
|
6
|
+
/** Human-readable message */
|
|
7
|
+
message: string;
|
|
8
|
+
/** Processing percentage (for INITIALIZING state) */
|
|
9
|
+
percentage?: number;
|
|
10
|
+
/** Callback for retry button */
|
|
11
|
+
onRetry?: () => void;
|
|
12
|
+
/** Whether to show the overlay */
|
|
13
|
+
visible?: boolean;
|
|
14
|
+
/** Additional className */
|
|
15
|
+
className?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* StreamStateOverlay - Shows stream status when not playable
|
|
19
|
+
*
|
|
20
|
+
* Slab-based design with header/body/actions zones.
|
|
21
|
+
* Uses Tokyo Night color palette and seam-based layout.
|
|
22
|
+
*/
|
|
23
|
+
export declare const StreamStateOverlay: React.FC<StreamStateOverlayProps>;
|
|
24
|
+
export default StreamStateOverlay;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { SubtitleCue, MetaTrackEvent } from '../types';
|
|
3
|
+
export interface SubtitleRendererProps {
|
|
4
|
+
/** Current video playback time in seconds */
|
|
5
|
+
currentTime: number;
|
|
6
|
+
/** Whether subtitles are enabled */
|
|
7
|
+
enabled?: boolean;
|
|
8
|
+
/** Subtitle cues to render (static or from meta track) */
|
|
9
|
+
cues?: SubtitleCue[];
|
|
10
|
+
/** Subscribe to meta track function (for live subtitles) */
|
|
11
|
+
subscribeToMetaTrack?: (trackId: string, callback: (event: MetaTrackEvent) => void) => () => void;
|
|
12
|
+
/** Meta track ID for live subtitles */
|
|
13
|
+
metaTrackId?: string;
|
|
14
|
+
/** Custom styles */
|
|
15
|
+
style?: SubtitleStyle;
|
|
16
|
+
/** Container class name */
|
|
17
|
+
className?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface SubtitleStyle {
|
|
20
|
+
/** Font size (default: '1.5rem') */
|
|
21
|
+
fontSize?: string;
|
|
22
|
+
/** Font family (default: system) */
|
|
23
|
+
fontFamily?: string;
|
|
24
|
+
/** Text color (default: 'white') */
|
|
25
|
+
color?: string;
|
|
26
|
+
/** Background color (default: 'rgba(0,0,0,0.75)') */
|
|
27
|
+
backgroundColor?: string;
|
|
28
|
+
/** Text shadow for readability */
|
|
29
|
+
textShadow?: string;
|
|
30
|
+
/** Bottom offset from video (default: '5%') */
|
|
31
|
+
bottom?: string;
|
|
32
|
+
/** Max width (default: '90%') */
|
|
33
|
+
maxWidth?: string;
|
|
34
|
+
/** Padding (default: '0.5em 1em') */
|
|
35
|
+
padding?: string;
|
|
36
|
+
/** Border radius (default: '4px') */
|
|
37
|
+
borderRadius?: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* SubtitleRenderer - Renders live or static subtitles over video
|
|
41
|
+
*
|
|
42
|
+
* Supports:
|
|
43
|
+
* - Static cue list (pre-loaded)
|
|
44
|
+
* - Live cues from meta track subscription
|
|
45
|
+
* - Customizable styling (font, colors, position)
|
|
46
|
+
* - Automatic timing synchronization with video
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```tsx
|
|
50
|
+
* // Static subtitles
|
|
51
|
+
* <SubtitleRenderer
|
|
52
|
+
* currentTime={videoElement.currentTime}
|
|
53
|
+
* enabled={showSubtitles}
|
|
54
|
+
* cues={subtitleCues}
|
|
55
|
+
* />
|
|
56
|
+
*
|
|
57
|
+
* // Live subtitles from meta track
|
|
58
|
+
* const { subscribe } = useMetaTrack({ mistBaseUrl, streamName });
|
|
59
|
+
*
|
|
60
|
+
* <SubtitleRenderer
|
|
61
|
+
* currentTime={videoElement.currentTime}
|
|
62
|
+
* enabled={showSubtitles}
|
|
63
|
+
* subscribeToMetaTrack={subscribe}
|
|
64
|
+
* metaTrackId="subtitle-track"
|
|
65
|
+
* />
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
export declare const SubtitleRenderer: React.FC<SubtitleRendererProps>;
|
|
69
|
+
export default SubtitleRenderer;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface TitleOverlayProps {
|
|
3
|
+
title?: string | null;
|
|
4
|
+
description?: string | null;
|
|
5
|
+
isVisible: boolean;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Title/description overlay that appears at the top of the player.
|
|
10
|
+
* Visible on hover or when paused - controlled by parent via isVisible prop.
|
|
11
|
+
*/
|
|
12
|
+
declare const TitleOverlay: React.FC<TitleOverlayProps>;
|
|
13
|
+
export default TitleOverlay;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DASH.js Player - React Wrapper
|
|
3
|
+
*
|
|
4
|
+
* MPEG-DASH streaming via dash.js library.
|
|
5
|
+
* The implementation is in @livepeer-frameworks/player-core.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { DashJsPlayerImpl } from '@livepeer-frameworks/player-core';
|
|
9
|
+
export { DashJsPlayerImpl };
|
|
10
|
+
type Props = {
|
|
11
|
+
src: string;
|
|
12
|
+
muted?: boolean;
|
|
13
|
+
autoPlay?: boolean;
|
|
14
|
+
controls?: boolean;
|
|
15
|
+
onError?: (e: Error) => void;
|
|
16
|
+
};
|
|
17
|
+
declare const DashJsPlayer: React.FC<Props>;
|
|
18
|
+
export default DashJsPlayer;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HLS.js Player - React Wrapper
|
|
3
|
+
*
|
|
4
|
+
* Adaptive HLS streaming via hls.js library.
|
|
5
|
+
* The implementation is in @livepeer-frameworks/player-core.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { HlsJsPlayerImpl } from '@livepeer-frameworks/player-core';
|
|
9
|
+
export { HlsJsPlayerImpl };
|
|
10
|
+
type Props = {
|
|
11
|
+
src: string;
|
|
12
|
+
muted?: boolean;
|
|
13
|
+
autoPlay?: boolean;
|
|
14
|
+
controls?: boolean;
|
|
15
|
+
onError?: (e: Error) => void;
|
|
16
|
+
};
|
|
17
|
+
declare const HlsJsPlayer: React.FC<Props>;
|
|
18
|
+
export default HlsJsPlayer;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MEWS WebSocket Player - React Wrapper
|
|
3
|
+
*
|
|
4
|
+
* Low-latency WebSocket MP4 streaming using MediaSource Extensions.
|
|
5
|
+
* The implementation is in @livepeer-frameworks/player-core.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { MewsWsPlayerImpl } from '@livepeer-frameworks/player-core';
|
|
9
|
+
export { MewsWsPlayerImpl };
|
|
10
|
+
type Props = {
|
|
11
|
+
wsUrl: string;
|
|
12
|
+
muted?: boolean;
|
|
13
|
+
autoPlay?: boolean;
|
|
14
|
+
controls?: boolean;
|
|
15
|
+
onError?: (e: Error) => void;
|
|
16
|
+
};
|
|
17
|
+
declare const MewsWsPlayer: React.FC<Props>;
|
|
18
|
+
export default MewsWsPlayer;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MistServer Legacy Player - React Wrapper
|
|
3
|
+
*
|
|
4
|
+
* Fallback player using MistServer's native player.js.
|
|
5
|
+
* The implementation is in @livepeer-frameworks/player-core.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { MistPlayerImpl } from '@livepeer-frameworks/player-core';
|
|
9
|
+
export { MistPlayerImpl };
|
|
10
|
+
type Props = {
|
|
11
|
+
src: string;
|
|
12
|
+
streamName?: string;
|
|
13
|
+
muted?: boolean;
|
|
14
|
+
autoPlay?: boolean;
|
|
15
|
+
controls?: boolean;
|
|
16
|
+
devMode?: boolean;
|
|
17
|
+
onError?: (e: Error) => void;
|
|
18
|
+
};
|
|
19
|
+
declare const MistPlayer: React.FC<Props>;
|
|
20
|
+
export default MistPlayer;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MistWebRTC Player - React Wrapper
|
|
3
|
+
*
|
|
4
|
+
* MistServer native WebRTC with signaling for DVR support.
|
|
5
|
+
* The implementation is in @livepeer-frameworks/player-core.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { MistWebRTCPlayerImpl } from '@livepeer-frameworks/player-core';
|
|
9
|
+
export { MistWebRTCPlayerImpl };
|
|
10
|
+
interface Props {
|
|
11
|
+
src: string;
|
|
12
|
+
autoPlay?: boolean;
|
|
13
|
+
muted?: boolean;
|
|
14
|
+
controls?: boolean;
|
|
15
|
+
poster?: string;
|
|
16
|
+
onReady?: (video: HTMLVideoElement) => void;
|
|
17
|
+
onError?: (error: Error) => void;
|
|
18
|
+
}
|
|
19
|
+
export declare const MistWebRTCPlayer: React.FC<Props>;
|
|
20
|
+
export default MistWebRTCPlayerImpl;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Native Player - React Wrapper
|
|
3
|
+
*
|
|
4
|
+
* HTML5 video and WHEP WebRTC playback.
|
|
5
|
+
* The implementation is in @livepeer-frameworks/player-core.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { NativePlayerImpl, DirectPlaybackPlayerImpl } from '@livepeer-frameworks/player-core';
|
|
9
|
+
export { NativePlayerImpl, DirectPlaybackPlayerImpl };
|
|
10
|
+
type Props = {
|
|
11
|
+
src: string;
|
|
12
|
+
type?: string;
|
|
13
|
+
muted?: boolean;
|
|
14
|
+
autoPlay?: boolean;
|
|
15
|
+
controls?: boolean;
|
|
16
|
+
onError?: (e: Error) => void;
|
|
17
|
+
};
|
|
18
|
+
declare const NativePlayer: React.FC<Props>;
|
|
19
|
+
export default NativePlayer;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Video.js Player - React Wrapper
|
|
3
|
+
*
|
|
4
|
+
* HLS streaming via Video.js with VHS (videojs-http-streaming).
|
|
5
|
+
* The implementation is in @livepeer-frameworks/player-core.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { VideoJsPlayerImpl } from '@livepeer-frameworks/player-core';
|
|
9
|
+
export { VideoJsPlayerImpl };
|
|
10
|
+
type Props = {
|
|
11
|
+
src: string;
|
|
12
|
+
muted?: boolean;
|
|
13
|
+
autoPlay?: boolean;
|
|
14
|
+
controls?: boolean;
|
|
15
|
+
onError?: (e: Error) => void;
|
|
16
|
+
};
|
|
17
|
+
declare const VideoJsPlayer: React.FC<Props>;
|
|
18
|
+
export default VideoJsPlayer;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PlayerContext
|
|
3
|
+
*
|
|
4
|
+
* React context for sharing PlayerController state across components.
|
|
5
|
+
* Follows the "context wraps hook" pattern (same as npm_studio).
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* ```tsx
|
|
9
|
+
* <PlayerProvider config={{ contentId: 'stream-1', contentType: 'live' }}>
|
|
10
|
+
* <PlayerControls />
|
|
11
|
+
* </PlayerProvider>
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
import React, { type ReactNode } from 'react';
|
|
15
|
+
import { type UsePlayerControllerConfig, type UsePlayerControllerReturn } from '../hooks/usePlayerController';
|
|
16
|
+
declare const PlayerContext: React.Context<UsePlayerControllerReturn | null>;
|
|
17
|
+
export interface PlayerProviderProps {
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
/** Configuration for the player controller */
|
|
20
|
+
config: UsePlayerControllerConfig;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Provider component that wraps Player and its controls.
|
|
24
|
+
* Calls usePlayerController internally and shares state via context.
|
|
25
|
+
*/
|
|
26
|
+
export declare function PlayerProvider({ children, config }: PlayerProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
/**
|
|
28
|
+
* Hook to access player context.
|
|
29
|
+
* Must be used within a PlayerProvider.
|
|
30
|
+
*/
|
|
31
|
+
export declare function usePlayerContext(): UsePlayerControllerReturn;
|
|
32
|
+
/**
|
|
33
|
+
* Hook to optionally access player context.
|
|
34
|
+
* Returns null if not within a PlayerProvider (no error thrown).
|
|
35
|
+
* Use this when component may or may not be within a PlayerProvider.
|
|
36
|
+
*/
|
|
37
|
+
export declare function usePlayerContextOptional(): UsePlayerControllerReturn | null;
|
|
38
|
+
export { PlayerContext };
|
|
39
|
+
export type { UsePlayerControllerReturn as PlayerContextValue };
|
|
40
|
+
export type { UsePlayerControllerConfig };
|