@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
package/src/ui/context-menu.tsx
CHANGED
|
@@ -1,40 +1,36 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
import * as ContextMenuPrimitive from "@radix-ui/react-context-menu"
|
|
3
|
-
import { Check, ChevronRight, Circle } from "lucide-react"
|
|
4
|
-
import { cn } from "@livepeer-frameworks/player-core"
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
|
|
3
|
+
import { Check, ChevronRight, Circle } from "lucide-react";
|
|
4
|
+
import { cn } from "@livepeer-frameworks/player-core";
|
|
5
5
|
|
|
6
|
-
const ContextMenu = ContextMenuPrimitive.Root
|
|
6
|
+
const ContextMenu = ContextMenuPrimitive.Root;
|
|
7
7
|
|
|
8
|
-
const ContextMenuTrigger = ContextMenuPrimitive.Trigger
|
|
8
|
+
const ContextMenuTrigger = ContextMenuPrimitive.Trigger;
|
|
9
9
|
|
|
10
|
-
const ContextMenuGroup = ContextMenuPrimitive.Group
|
|
10
|
+
const ContextMenuGroup = ContextMenuPrimitive.Group;
|
|
11
11
|
|
|
12
|
-
const ContextMenuPortal = ContextMenuPrimitive.Portal
|
|
12
|
+
const ContextMenuPortal = ContextMenuPrimitive.Portal;
|
|
13
13
|
|
|
14
|
-
const ContextMenuSub = ContextMenuPrimitive.Sub
|
|
14
|
+
const ContextMenuSub = ContextMenuPrimitive.Sub;
|
|
15
15
|
|
|
16
|
-
const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup
|
|
16
|
+
const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;
|
|
17
17
|
|
|
18
18
|
const ContextMenuSubTrigger = React.forwardRef<
|
|
19
19
|
React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>,
|
|
20
20
|
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> & {
|
|
21
|
-
inset?: boolean
|
|
21
|
+
inset?: boolean;
|
|
22
22
|
}
|
|
23
23
|
>(({ className, inset, children, ...props }, ref) => (
|
|
24
24
|
<ContextMenuPrimitive.SubTrigger
|
|
25
25
|
ref={ref}
|
|
26
|
-
className={cn(
|
|
27
|
-
"fw-context-menu-item",
|
|
28
|
-
inset && "fw-context-menu-item--inset",
|
|
29
|
-
className
|
|
30
|
-
)}
|
|
26
|
+
className={cn("fw-context-menu-item", inset && "fw-context-menu-item--inset", className)}
|
|
31
27
|
{...props}
|
|
32
28
|
>
|
|
33
29
|
{children}
|
|
34
30
|
<ChevronRight className="ml-auto h-4 w-4" />
|
|
35
31
|
</ContextMenuPrimitive.SubTrigger>
|
|
36
|
-
))
|
|
37
|
-
ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName
|
|
32
|
+
));
|
|
33
|
+
ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;
|
|
38
34
|
|
|
39
35
|
const ContextMenuSubContent = React.forwardRef<
|
|
40
36
|
React.ElementRef<typeof ContextMenuPrimitive.SubContent>,
|
|
@@ -45,8 +41,8 @@ const ContextMenuSubContent = React.forwardRef<
|
|
|
45
41
|
className={cn("fw-player-surface fw-context-menu", className)}
|
|
46
42
|
{...props}
|
|
47
43
|
/>
|
|
48
|
-
))
|
|
49
|
-
ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName
|
|
44
|
+
));
|
|
45
|
+
ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;
|
|
50
46
|
|
|
51
47
|
const ContextMenuContent = React.forwardRef<
|
|
52
48
|
React.ElementRef<typeof ContextMenuPrimitive.Content>,
|
|
@@ -59,34 +55,30 @@ const ContextMenuContent = React.forwardRef<
|
|
|
59
55
|
style={{
|
|
60
56
|
// Inline styles for portal elements (rendered outside .fw-player-root)
|
|
61
57
|
// These ensure styles work even without CSS variable inheritance
|
|
62
|
-
backgroundColor:
|
|
63
|
-
color:
|
|
64
|
-
border:
|
|
65
|
-
...style
|
|
58
|
+
backgroundColor: "hsl(235 19% 13%)",
|
|
59
|
+
color: "hsl(229 35% 75%)",
|
|
60
|
+
border: "1px solid rgba(90, 96, 127, 0.3)",
|
|
61
|
+
...style,
|
|
66
62
|
}}
|
|
67
63
|
{...props}
|
|
68
64
|
/>
|
|
69
65
|
</ContextMenuPrimitive.Portal>
|
|
70
|
-
))
|
|
71
|
-
ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName
|
|
66
|
+
));
|
|
67
|
+
ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;
|
|
72
68
|
|
|
73
69
|
const ContextMenuItem = React.forwardRef<
|
|
74
70
|
React.ElementRef<typeof ContextMenuPrimitive.Item>,
|
|
75
71
|
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & {
|
|
76
|
-
inset?: boolean
|
|
72
|
+
inset?: boolean;
|
|
77
73
|
}
|
|
78
74
|
>(({ className, inset, ...props }, ref) => (
|
|
79
75
|
<ContextMenuPrimitive.Item
|
|
80
76
|
ref={ref}
|
|
81
|
-
className={cn(
|
|
82
|
-
"fw-context-menu-item",
|
|
83
|
-
inset && "fw-context-menu-item--inset",
|
|
84
|
-
className
|
|
85
|
-
)}
|
|
77
|
+
className={cn("fw-context-menu-item", inset && "fw-context-menu-item--inset", className)}
|
|
86
78
|
{...props}
|
|
87
79
|
/>
|
|
88
|
-
))
|
|
89
|
-
ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName
|
|
80
|
+
));
|
|
81
|
+
ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;
|
|
90
82
|
|
|
91
83
|
const ContextMenuCheckboxItem = React.forwardRef<
|
|
92
84
|
React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>,
|
|
@@ -105,9 +97,8 @@ const ContextMenuCheckboxItem = React.forwardRef<
|
|
|
105
97
|
</span>
|
|
106
98
|
{children}
|
|
107
99
|
</ContextMenuPrimitive.CheckboxItem>
|
|
108
|
-
))
|
|
109
|
-
ContextMenuCheckboxItem.displayName =
|
|
110
|
-
ContextMenuPrimitive.CheckboxItem.displayName
|
|
100
|
+
));
|
|
101
|
+
ContextMenuCheckboxItem.displayName = ContextMenuPrimitive.CheckboxItem.displayName;
|
|
111
102
|
|
|
112
103
|
const ContextMenuRadioItem = React.forwardRef<
|
|
113
104
|
React.ElementRef<typeof ContextMenuPrimitive.RadioItem>,
|
|
@@ -125,26 +116,22 @@ const ContextMenuRadioItem = React.forwardRef<
|
|
|
125
116
|
</span>
|
|
126
117
|
{children}
|
|
127
118
|
</ContextMenuPrimitive.RadioItem>
|
|
128
|
-
))
|
|
129
|
-
ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName
|
|
119
|
+
));
|
|
120
|
+
ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName;
|
|
130
121
|
|
|
131
122
|
const ContextMenuLabel = React.forwardRef<
|
|
132
123
|
React.ElementRef<typeof ContextMenuPrimitive.Label>,
|
|
133
124
|
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> & {
|
|
134
|
-
inset?: boolean
|
|
125
|
+
inset?: boolean;
|
|
135
126
|
}
|
|
136
127
|
>(({ className, inset, ...props }, ref) => (
|
|
137
128
|
<ContextMenuPrimitive.Label
|
|
138
129
|
ref={ref}
|
|
139
|
-
className={cn(
|
|
140
|
-
"fw-context-menu-label",
|
|
141
|
-
inset && "fw-context-menu-item--inset",
|
|
142
|
-
className
|
|
143
|
-
)}
|
|
130
|
+
className={cn("fw-context-menu-label", inset && "fw-context-menu-item--inset", className)}
|
|
144
131
|
{...props}
|
|
145
132
|
/>
|
|
146
|
-
))
|
|
147
|
-
ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName
|
|
133
|
+
));
|
|
134
|
+
ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName;
|
|
148
135
|
|
|
149
136
|
const ContextMenuSeparator = React.forwardRef<
|
|
150
137
|
React.ElementRef<typeof ContextMenuPrimitive.Separator>,
|
|
@@ -155,24 +142,18 @@ const ContextMenuSeparator = React.forwardRef<
|
|
|
155
142
|
className={cn("fw-context-menu-separator", className)}
|
|
156
143
|
{...props}
|
|
157
144
|
/>
|
|
158
|
-
))
|
|
159
|
-
ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName
|
|
145
|
+
));
|
|
146
|
+
ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName;
|
|
160
147
|
|
|
161
|
-
const ContextMenuShortcut = ({
|
|
162
|
-
className,
|
|
163
|
-
...props
|
|
164
|
-
}: React.HTMLAttributes<HTMLSpanElement>) => {
|
|
148
|
+
const ContextMenuShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => {
|
|
165
149
|
return (
|
|
166
150
|
<span
|
|
167
|
-
className={cn(
|
|
168
|
-
"ml-auto text-xs tracking-widest text-muted-foreground",
|
|
169
|
-
className
|
|
170
|
-
)}
|
|
151
|
+
className={cn("ml-auto text-xs tracking-widest text-muted-foreground", className)}
|
|
171
152
|
{...props}
|
|
172
153
|
/>
|
|
173
|
-
)
|
|
174
|
-
}
|
|
175
|
-
ContextMenuShortcut.displayName = "ContextMenuShortcut"
|
|
154
|
+
);
|
|
155
|
+
};
|
|
156
|
+
ContextMenuShortcut.displayName = "ContextMenuShortcut";
|
|
176
157
|
|
|
177
158
|
export {
|
|
178
159
|
ContextMenu,
|
|
@@ -190,4 +171,4 @@ export {
|
|
|
190
171
|
ContextMenuSubContent,
|
|
191
172
|
ContextMenuSubTrigger,
|
|
192
173
|
ContextMenuRadioGroup,
|
|
193
|
-
}
|
|
174
|
+
};
|
package/src/ui/select.tsx
CHANGED
|
@@ -41,13 +41,11 @@ const SelectContent = React.forwardRef<
|
|
|
41
41
|
position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1",
|
|
42
42
|
className
|
|
43
43
|
)}
|
|
44
|
-
style={{ backgroundColor:
|
|
44
|
+
style={{ backgroundColor: "#1a1b26" }} // Inline fallback for opaque background
|
|
45
45
|
position={position}
|
|
46
46
|
{...props}
|
|
47
47
|
>
|
|
48
|
-
<SelectPrimitive.Viewport className="p-1">
|
|
49
|
-
{children}
|
|
50
|
-
</SelectPrimitive.Viewport>
|
|
48
|
+
<SelectPrimitive.Viewport className="p-1">{children}</SelectPrimitive.Viewport>
|
|
51
49
|
</SelectPrimitive.Content>
|
|
52
50
|
</SelectPrimitive.Portal>
|
|
53
51
|
));
|
|
@@ -82,7 +80,11 @@ const SelectLabel = React.forwardRef<
|
|
|
82
80
|
React.ElementRef<typeof SelectPrimitive.Label>,
|
|
83
81
|
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
|
|
84
82
|
>(({ className, ...props }, ref) => (
|
|
85
|
-
<SelectPrimitive.Label
|
|
83
|
+
<SelectPrimitive.Label
|
|
84
|
+
ref={ref}
|
|
85
|
+
className={cn("px-2 py-1.5 text-xs font-semibold text-muted-foreground", className)}
|
|
86
|
+
{...props}
|
|
87
|
+
/>
|
|
86
88
|
));
|
|
87
89
|
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
88
90
|
|
|
@@ -90,7 +92,11 @@ const SelectSeparator = React.forwardRef<
|
|
|
90
92
|
React.ElementRef<typeof SelectPrimitive.Separator>,
|
|
91
93
|
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
|
|
92
94
|
>(({ className, ...props }, ref) => (
|
|
93
|
-
<SelectPrimitive.Separator
|
|
95
|
+
<SelectPrimitive.Separator
|
|
96
|
+
ref={ref}
|
|
97
|
+
className={cn("-mx-1 my-1 h-px bg-muted", className)}
|
|
98
|
+
{...props}
|
|
99
|
+
/>
|
|
94
100
|
));
|
|
95
101
|
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
|
|
96
102
|
|
|
@@ -101,5 +107,5 @@ export {
|
|
|
101
107
|
SelectLabel,
|
|
102
108
|
SelectSeparator,
|
|
103
109
|
SelectTrigger,
|
|
104
|
-
SelectValue
|
|
110
|
+
SelectValue,
|
|
105
111
|
};
|
package/src/ui/slider.tsx
CHANGED
|
@@ -13,48 +13,37 @@ export interface SliderProps extends React.ComponentPropsWithoutRef<typeof Slide
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
const Slider = React.forwardRef<React.ElementRef<typeof SliderPrimitive.Root>, SliderProps>(
|
|
16
|
-
(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
(
|
|
17
|
+
{
|
|
18
|
+
className,
|
|
19
|
+
trackClassName,
|
|
20
|
+
thumbClassName,
|
|
21
|
+
showTrack = true,
|
|
22
|
+
hoverThumb: _hoverThumb = false,
|
|
23
|
+
accentColor = false,
|
|
24
|
+
orientation = "horizontal",
|
|
25
|
+
...props
|
|
26
|
+
},
|
|
27
|
+
ref
|
|
28
|
+
) => {
|
|
21
29
|
return (
|
|
22
30
|
<SliderPrimitive.Root
|
|
23
31
|
ref={ref}
|
|
24
32
|
orientation={orientation}
|
|
25
|
-
className={cn(
|
|
26
|
-
"group relative flex touch-none select-none items-center cursor-pointer",
|
|
27
|
-
orientation === "horizontal" ? "w-full h-5" : "h-full flex-col w-5",
|
|
28
|
-
className
|
|
29
|
-
)}
|
|
33
|
+
className={cn("fw-slider", orientation === "vertical" && "fw-slider--vertical", className)}
|
|
30
34
|
{...props}
|
|
31
35
|
>
|
|
32
36
|
{showTrack && (
|
|
33
|
-
<SliderPrimitive.Track
|
|
34
|
-
className={cn(
|
|
35
|
-
"absolute rounded-full bg-white/30 transition-all duration-150",
|
|
36
|
-
orientation === "horizontal"
|
|
37
|
-
? "inset-x-0 h-1 group-hover:h-1.5"
|
|
38
|
-
: "inset-y-0 w-1 group-hover:w-1.5",
|
|
39
|
-
trackClassName
|
|
40
|
-
)}
|
|
41
|
-
>
|
|
37
|
+
<SliderPrimitive.Track className={cn("fw-slider-track", trackClassName)}>
|
|
42
38
|
<SliderPrimitive.Range
|
|
43
|
-
className={cn(
|
|
44
|
-
"absolute rounded-full transition-all duration-150",
|
|
45
|
-
orientation === "horizontal" ? "h-full" : "w-full bottom-0",
|
|
46
|
-
rangeColorClass
|
|
47
|
-
)}
|
|
39
|
+
className={cn("fw-slider-range", accentColor && "fw-slider-range--accent")}
|
|
48
40
|
/>
|
|
49
41
|
</SliderPrimitive.Track>
|
|
50
42
|
)}
|
|
51
43
|
<SliderPrimitive.Thumb
|
|
52
44
|
className={cn(
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/50",
|
|
56
|
-
"disabled:pointer-events-none disabled:opacity-50",
|
|
57
|
-
thumbColorClass,
|
|
45
|
+
"fw-slider-thumb",
|
|
46
|
+
accentColor && "fw-slider-thumb--accent",
|
|
58
47
|
thumbClassName
|
|
59
48
|
)}
|
|
60
49
|
/>
|