@livepeer-frameworks/player-react 0.0.4 → 0.1.1
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/README.md +16 -5
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/types/components/PlayerControls.d.ts +2 -0
- package/dist/types/components/StatsPanel.d.ts +2 -14
- package/dist/types/hooks/useMetaTrack.d.ts +1 -1
- package/dist/types/hooks/usePlayerController.d.ts +2 -0
- package/dist/types/hooks/useStreamState.d.ts +1 -1
- package/dist/types/hooks/useTelemetry.d.ts +1 -1
- package/dist/types/hooks/useViewerEndpoints.d.ts +2 -2
- package/dist/types/types.d.ts +1 -1
- package/dist/types/ui/button.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/DevModePanel.tsx +249 -170
- package/src/components/Icons.tsx +105 -25
- package/src/components/IdleScreen.tsx +262 -142
- package/src/components/LoadingScreen.tsx +171 -153
- package/src/components/LogoOverlay.tsx +3 -6
- package/src/components/Player.tsx +86 -74
- package/src/components/PlayerControls.tsx +351 -263
- package/src/components/PlayerErrorBoundary.tsx +6 -13
- package/src/components/SeekBar.tsx +96 -88
- package/src/components/SkipIndicator.tsx +2 -12
- package/src/components/SpeedIndicator.tsx +2 -11
- package/src/components/StatsPanel.tsx +65 -34
- package/src/components/StreamStateOverlay.tsx +105 -49
- package/src/components/SubtitleRenderer.tsx +29 -29
- package/src/components/ThumbnailOverlay.tsx +5 -6
- package/src/components/TitleOverlay.tsx +2 -8
- package/src/components/players/DashJsPlayer.tsx +13 -11
- package/src/components/players/HlsJsPlayer.tsx +13 -11
- package/src/components/players/MewsWsPlayer/index.tsx +13 -11
- package/src/components/players/MistPlayer.tsx +13 -11
- package/src/components/players/MistWebRTCPlayer/index.tsx +19 -10
- package/src/components/players/NativePlayer.tsx +10 -12
- package/src/components/players/VideoJsPlayer.tsx +13 -11
- package/src/context/PlayerContext.tsx +4 -8
- package/src/context/index.ts +3 -3
- package/src/hooks/useMetaTrack.ts +28 -28
- package/src/hooks/usePlaybackQuality.ts +3 -3
- package/src/hooks/usePlayerController.ts +186 -140
- package/src/hooks/usePlayerSelection.ts +6 -6
- package/src/hooks/useStreamState.ts +53 -58
- package/src/hooks/useTelemetry.ts +19 -4
- package/src/hooks/useViewerEndpoints.ts +40 -30
- package/src/index.tsx +36 -28
- package/src/types.ts +9 -9
- package/src/ui/badge.tsx +6 -5
- package/src/ui/button.tsx +9 -8
- package/src/ui/context-menu.tsx +42 -61
- package/src/ui/select.tsx +13 -7
- package/src/ui/slider.tsx +18 -29
|
@@ -55,6 +55,8 @@ interface PlayerControlsProps {
|
|
|
55
55
|
isLoopEnabled?: boolean;
|
|
56
56
|
/** Toggle loop callback */
|
|
57
57
|
onToggleLoop?: () => void;
|
|
58
|
+
/** Jump to live edge callback */
|
|
59
|
+
onJumpToLive?: () => void;
|
|
58
60
|
}
|
|
59
61
|
declare const PlayerControls: React.FC<PlayerControlsProps>;
|
|
60
62
|
export default PlayerControls;
|
|
@@ -1,22 +1,10 @@
|
|
|
1
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
|
-
}
|
|
2
|
+
import { type ContentMetadata, type PlaybackQuality, type StreamState } from "@livepeer-frameworks/player-core";
|
|
15
3
|
interface StatsPanelProps {
|
|
16
4
|
isOpen: boolean;
|
|
17
5
|
onClose: () => void;
|
|
18
6
|
metadata?: ContentMetadata | null;
|
|
19
|
-
streamState?:
|
|
7
|
+
streamState?: StreamState | null;
|
|
20
8
|
quality?: PlaybackQuality | null;
|
|
21
9
|
videoElement?: HTMLVideoElement | null;
|
|
22
10
|
protocol?: string;
|
|
@@ -33,7 +33,7 @@ export interface UseMetaTrackReturn {
|
|
|
33
33
|
* ```tsx
|
|
34
34
|
* const { isConnected, subscribe } = useMetaTrack({
|
|
35
35
|
* mistBaseUrl: 'https://mist.example.com',
|
|
36
|
-
* streamName: '
|
|
36
|
+
* streamName: 'pk_...', // playbackId (view key)
|
|
37
37
|
* enabled: true,
|
|
38
38
|
* });
|
|
39
39
|
*
|
|
@@ -117,6 +117,8 @@ export interface UsePlayerControllerReturn {
|
|
|
117
117
|
seek: (time: number) => void;
|
|
118
118
|
/** Seek by delta */
|
|
119
119
|
seekBy: (delta: number) => void;
|
|
120
|
+
/** Jump to live edge (for live streams) */
|
|
121
|
+
jumpToLive: () => void;
|
|
120
122
|
/** Set volume */
|
|
121
123
|
setVolume: (volume: number) => void;
|
|
122
124
|
/** Toggle mute */
|
|
@@ -10,7 +10,7 @@ import type { UseStreamStateOptions, StreamState } from '../types';
|
|
|
10
10
|
* ```tsx
|
|
11
11
|
* const { status, isOnline, message } = useStreamState({
|
|
12
12
|
* mistBaseUrl: 'https://mist.example.com',
|
|
13
|
-
* streamName: '
|
|
13
|
+
* streamName: 'pk_...', // playbackId (view key)
|
|
14
14
|
* pollInterval: 3000,
|
|
15
15
|
* });
|
|
16
16
|
* ```
|
|
@@ -33,7 +33,7 @@ export interface UseTelemetryOptions extends TelemetryOptions {
|
|
|
33
33
|
* endpoint: '/api/telemetry',
|
|
34
34
|
* interval: 5000,
|
|
35
35
|
* videoElement,
|
|
36
|
-
* contentId: '
|
|
36
|
+
* contentId: 'pk_...', // playbackId (view key)
|
|
37
37
|
* contentType: 'live',
|
|
38
38
|
* playerType: 'hlsjs',
|
|
39
39
|
* protocol: 'HLS',
|
|
@@ -2,11 +2,11 @@ import type { ContentType } from '@livepeer-frameworks/player-core';
|
|
|
2
2
|
import type { ContentEndpoints } from '../types';
|
|
3
3
|
interface Params {
|
|
4
4
|
gatewayUrl: string;
|
|
5
|
-
contentType: ContentType;
|
|
6
5
|
contentId: string;
|
|
6
|
+
contentType?: ContentType;
|
|
7
7
|
authToken?: string;
|
|
8
8
|
}
|
|
9
|
-
export declare function useViewerEndpoints({ gatewayUrl, contentType, contentId, authToken }: Params): {
|
|
9
|
+
export declare function useViewerEndpoints({ gatewayUrl, contentType: _contentType, contentId, authToken }: Params): {
|
|
10
10
|
endpoints: ContentEndpoints | null;
|
|
11
11
|
status: "error" | "ready" | "idle" | "loading";
|
|
12
12
|
error: string | null;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export interface PlayerProps {
|
|
|
7
7
|
/** Content identifier or stream name */
|
|
8
8
|
contentId: string;
|
|
9
9
|
/** Content type */
|
|
10
|
-
contentType
|
|
10
|
+
contentType?: ContentType;
|
|
11
11
|
/** Pre-resolved endpoints/capabilities from Gateway/Foghorn */
|
|
12
12
|
endpoints?: ContentEndpoints;
|
|
13
13
|
/** Optional thumbnail/poster image */
|
|
@@ -2,7 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
import { type VariantProps } from "class-variance-authority";
|
|
3
3
|
declare const buttonVariants: (props?: ({
|
|
4
4
|
variant?: "link" | "default" | "secondary" | "ghost" | "outline" | "destructive" | "subtle" | null | undefined;
|
|
5
|
-
size?: "default" | "
|
|
5
|
+
size?: "default" | "icon" | "sm" | "lg" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
7
|
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
8
8
|
asChild?: boolean;
|