react-helios 2.4.0 → 2.7.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.
- package/README.md +216 -72
- package/dist/index.d.mts +93 -67
- package/dist/index.d.ts +93 -67
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +135 -0
- package/package.json +5 -3
- package/dist/index.css +0 -2
- package/dist/index.css.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -5,30 +5,57 @@ import { HlsConfig } from 'hls.js';
|
|
|
5
5
|
/**
|
|
6
6
|
* Preset bandwidth thresholds (Kbps) for automatic audio mode switching.
|
|
7
7
|
*
|
|
8
|
-
* | Preset | Kbps | Typical connection
|
|
9
|
-
*
|
|
10
|
-
* | EXTREME | 100 | 2G / Edge
|
|
11
|
-
* | POOR | 300 | Slow 3G
|
|
12
|
-
* | FAIR |
|
|
13
|
-
* | GOOD | 1500 | 4G / Wi-Fi
|
|
8
|
+
* | Preset | Kbps | Typical connection |
|
|
9
|
+
* |-----------|------|--------------------------------|
|
|
10
|
+
* | EXTREME | 100 | 2G / Edge |
|
|
11
|
+
* | POOR | 300 | Slow 3G |
|
|
12
|
+
* | FAIR | 800 | Marginal 3G ← **recommended** |
|
|
13
|
+
* | GOOD | 1500 | Weak 4G / congested Wi-Fi |
|
|
14
14
|
*
|
|
15
15
|
* Pass any of these (or a custom number) as `audioBandwidthThreshold`.
|
|
16
|
-
* Set to `0` to disable
|
|
16
|
+
* Set to `0` to disable bandwidth-based switching entirely.
|
|
17
17
|
*
|
|
18
18
|
* @example
|
|
19
19
|
* import { AUDIO_BANDWIDTH_THRESHOLDS } from "react-helios";
|
|
20
|
-
* <VideoPlayer
|
|
20
|
+
* <VideoPlayer options={{ audioBandwidthThreshold: AUDIO_BANDWIDTH_THRESHOLDS.FAIR }} />
|
|
21
21
|
*/
|
|
22
22
|
declare const AUDIO_BANDWIDTH_THRESHOLDS: {
|
|
23
23
|
/** < 100 Kbps — very poor, 2G / Edge */
|
|
24
24
|
readonly EXTREME: 100;
|
|
25
|
-
/** < 300 Kbps — poor, slow 3G
|
|
25
|
+
/** < 300 Kbps — poor, slow 3G */
|
|
26
26
|
readonly POOR: 300;
|
|
27
|
-
/** <
|
|
28
|
-
readonly FAIR:
|
|
29
|
-
/** < 1500 Kbps —
|
|
27
|
+
/** < 800 Kbps — marginal 3G ← **recommended default** */
|
|
28
|
+
readonly FAIR: 800;
|
|
29
|
+
/** < 1500 Kbps — weak 4G / congested Wi-Fi */
|
|
30
30
|
readonly GOOD: 1500;
|
|
31
31
|
};
|
|
32
|
+
/**
|
|
33
|
+
* Preset HLS quality level indices for automatic audio mode switching.
|
|
34
|
+
*
|
|
35
|
+
* When HLS.js drops to this level or below (due to poor bandwidth), the player
|
|
36
|
+
* automatically switches to audio mode. Level `0` is always the lowest quality
|
|
37
|
+
* available in the manifest.
|
|
38
|
+
*
|
|
39
|
+
* | Preset | Value | Meaning |
|
|
40
|
+
* |----------------|-------|-----------------------------------------------|
|
|
41
|
+
* | LOWEST | 0 | Switch when at the very lowest quality ← **recommended** |
|
|
42
|
+
* | SECOND_LOWEST | 1 | Switch one level above the lowest |
|
|
43
|
+
* | DISABLED | -1 | Disable level-based switching entirely |
|
|
44
|
+
*
|
|
45
|
+
* Works alongside `audioBandwidthThreshold` — whichever fires first wins.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* import { AUDIO_SWITCH_LEVELS } from "react-helios";
|
|
49
|
+
* <VideoPlayer options={{ audioModeSwitchLevel: AUDIO_SWITCH_LEVELS.LOWEST }} />
|
|
50
|
+
*/
|
|
51
|
+
declare const AUDIO_SWITCH_LEVELS: {
|
|
52
|
+
/** Switch when HLS.js is at the lowest available quality (recommended default). */
|
|
53
|
+
readonly LOWEST: 0;
|
|
54
|
+
/** Switch when HLS.js drops to the second-lowest quality. */
|
|
55
|
+
readonly SECOND_LOWEST: 1;
|
|
56
|
+
/** Disable level-based auto-switching. */
|
|
57
|
+
readonly DISABLED: -1;
|
|
58
|
+
};
|
|
32
59
|
interface BufferedRange {
|
|
33
60
|
start: number;
|
|
34
61
|
end: number;
|
|
@@ -101,83 +128,77 @@ interface ControlBarItem {
|
|
|
101
128
|
title?: string;
|
|
102
129
|
onClick: () => void;
|
|
103
130
|
}
|
|
104
|
-
interface
|
|
105
|
-
src: string;
|
|
106
|
-
poster?: string;
|
|
131
|
+
interface VideoPlayerOptions {
|
|
107
132
|
autoplay?: boolean;
|
|
108
133
|
muted?: boolean;
|
|
109
134
|
loop?: boolean;
|
|
110
|
-
controls?: boolean;
|
|
111
135
|
preload?: "none" | "metadata" | "auto";
|
|
112
136
|
playbackRates?: PlaybackRate[];
|
|
113
|
-
className?: string;
|
|
114
137
|
enableHLS?: boolean;
|
|
138
|
+
hlsConfig?: Partial<HlsConfig>;
|
|
115
139
|
enablePreview?: boolean;
|
|
116
|
-
/**
|
|
117
|
-
* URL to a WebVTT thumbnail track for sprite-sheet preview on the progress bar.
|
|
118
|
-
*
|
|
119
|
-
* The VTT file should map time ranges to sprite-sheet coordinates using the
|
|
120
|
-
* standard `#xywh=x,y,w,h` fragment format:
|
|
121
|
-
*
|
|
122
|
-
* ```
|
|
123
|
-
* WEBVTT
|
|
124
|
-
*
|
|
125
|
-
* 00:00:00.000 --> 00:00:05.000
|
|
126
|
-
* https://cdn.example.com/thumbs/storyboard0.jpg#xywh=0,0,160,90
|
|
127
|
-
* ```
|
|
128
|
-
*
|
|
129
|
-
* When provided, hovering the progress bar shows a thumbnail instead of
|
|
130
|
-
* requiring a second video decode. If omitted, only the timestamp tooltip
|
|
131
|
-
* is shown.
|
|
132
|
-
*/
|
|
133
140
|
thumbnailVtt?: string;
|
|
134
|
-
|
|
141
|
+
autoHideControls?: boolean;
|
|
135
142
|
subtitles?: SubtitleTrack[];
|
|
136
143
|
crossOrigin?: "anonymous" | "use-credentials";
|
|
137
|
-
onPlay?: () => void;
|
|
138
|
-
onPause?: () => void;
|
|
139
|
-
onEnded?: () => void;
|
|
140
|
-
onError?: (error: VideoError) => void;
|
|
141
|
-
onTimeUpdate?: (time: number) => void;
|
|
142
|
-
onDurationChange?: (duration: number) => void;
|
|
143
|
-
onBuffering?: (isBuffering: boolean) => void;
|
|
144
|
-
onTheaterModeChange?: (isTheater: boolean) => void;
|
|
145
|
-
/**
|
|
146
|
-
* Image URL or ReactNode shown as artwork in audio mode.
|
|
147
|
-
* Priority: `poster` prop → `logo` string/ReactNode → waveform-only.
|
|
148
|
-
* If a string URL is provided the image is rendered white-normalised (filter invert)
|
|
149
|
-
* so it stands out on the dark background.
|
|
150
|
-
*/
|
|
151
144
|
logo?: string | ReactNode;
|
|
152
|
-
|
|
153
|
-
* Show the headphones / audio-mode toggle button in the control bar.
|
|
154
|
-
* @default true
|
|
155
|
-
*/
|
|
145
|
+
audioSrc?: string;
|
|
156
146
|
showAudioButton?: boolean;
|
|
147
|
+
audioModeIcon?: ReactNode;
|
|
148
|
+
videoModeIcon?: ReactNode;
|
|
157
149
|
/**
|
|
158
|
-
*
|
|
159
|
-
*
|
|
150
|
+
* Custom content shown in audio mode when no `poster` is provided.
|
|
151
|
+
* Replaces the default animated-gradient + waveform fallback entirely.
|
|
152
|
+
* The `logo` prop is still rendered on top of this if also provided.
|
|
160
153
|
*/
|
|
154
|
+
audioModeFallback?: ReactNode;
|
|
155
|
+
/** Label shown next to the icon when in video mode (click → switches to audio). Default: "Audio" */
|
|
156
|
+
audioModeLabel?: string;
|
|
157
|
+
/** Label shown next to the icon when in audio mode (click → switches to video). Default: "Video" */
|
|
158
|
+
videoModeLabel?: string;
|
|
161
159
|
defaultAudioMode?: boolean;
|
|
162
160
|
/**
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
* Set to `0` to disable automatic switching.
|
|
167
|
-
* Only applies to HLS streams (where hls.js measures real segment bandwidth).
|
|
168
|
-
* @default 300 (AUDIO_BANDWIDTH_THRESHOLDS.POOR)
|
|
161
|
+
* Kbps — switch to audio mode when rolling average bandwidth drops below this value.
|
|
162
|
+
* `0` disables bandwidth-based switching. Default: `300` (slow 3G).
|
|
163
|
+
* Works alongside `audioModeSwitchLevel` — whichever fires first wins.
|
|
169
164
|
*/
|
|
170
165
|
audioBandwidthThreshold?: number;
|
|
171
|
-
/**
|
|
166
|
+
/**
|
|
167
|
+
* HLS quality level index — switch to audio mode when HLS.js drops to this level or below.
|
|
168
|
+
* `0` = lowest quality (recommended default). `-1` disables level-based switching.
|
|
169
|
+
* Works alongside `audioBandwidthThreshold` — whichever fires first wins.
|
|
170
|
+
*/
|
|
171
|
+
audioModeSwitchLevel?: number;
|
|
172
|
+
/**
|
|
173
|
+
* Milliseconds between automatic recovery probes while in auto-switched audio mode.
|
|
174
|
+
* The player briefly resumes video loading to sample bandwidth, then switches back
|
|
175
|
+
* to video if conditions have improved. Default: `30000` (30 seconds).
|
|
176
|
+
*/
|
|
177
|
+
audioModeRecoveryInterval?: number;
|
|
178
|
+
onPlay?: () => void;
|
|
179
|
+
onPause?: () => void;
|
|
180
|
+
onEnded?: () => void;
|
|
181
|
+
onError?: (error: VideoError) => void;
|
|
182
|
+
onTimeUpdate?: (time: number) => void;
|
|
183
|
+
onDurationChange?: (duration: number) => void;
|
|
184
|
+
onBuffering?: (isBuffering: boolean) => void;
|
|
185
|
+
onTheaterModeChange?: (isTheater: boolean) => void;
|
|
172
186
|
onAudioModeChange?: (isAudio: boolean) => void;
|
|
173
187
|
contextMenuItems?: ContextMenuItem[];
|
|
174
188
|
controlBarItems?: ControlBarItem[];
|
|
175
189
|
}
|
|
190
|
+
interface VideoPlayerProps {
|
|
191
|
+
src: string;
|
|
192
|
+
poster?: string;
|
|
193
|
+
className?: string;
|
|
194
|
+
controls?: boolean;
|
|
195
|
+
options?: VideoPlayerOptions;
|
|
196
|
+
}
|
|
176
197
|
|
|
177
198
|
declare const VideoPlayer: react__default.ForwardRefExoticComponent<VideoPlayerProps & react__default.RefAttributes<VideoPlayerRef>>;
|
|
178
199
|
|
|
179
200
|
interface ControlsProps {
|
|
180
|
-
videoRef: react__default.RefObject<
|
|
201
|
+
videoRef: react__default.RefObject<HTMLMediaElement | null>;
|
|
181
202
|
playerRef: VideoPlayerRef;
|
|
182
203
|
playerContainerRef: react__default.RefObject<HTMLElement | null>;
|
|
183
204
|
playbackRates: PlaybackRate[];
|
|
@@ -192,15 +213,20 @@ interface ControlsProps {
|
|
|
192
213
|
isTheaterMode: boolean;
|
|
193
214
|
isAudioMode: boolean;
|
|
194
215
|
showAudioButton: boolean;
|
|
216
|
+
audioModeIcon?: ReactNode;
|
|
217
|
+
videoModeIcon?: ReactNode;
|
|
218
|
+
audioModeLabel?: string;
|
|
219
|
+
videoModeLabel?: string;
|
|
195
220
|
isLive: boolean;
|
|
196
221
|
qualityLevels: HLSQualityLevel[];
|
|
197
222
|
currentQualityLevel: number;
|
|
198
223
|
controlBarItems?: ControlBarItem[];
|
|
224
|
+
autoHideControls: boolean;
|
|
199
225
|
}
|
|
200
|
-
declare const Controls: react__default.
|
|
226
|
+
declare const Controls: react__default.NamedExoticComponent<ControlsProps>;
|
|
201
227
|
|
|
202
228
|
interface TimeDisplayProps {
|
|
203
|
-
videoRef: React.RefObject<
|
|
229
|
+
videoRef: React.RefObject<HTMLMediaElement | null>;
|
|
204
230
|
isLive?: boolean;
|
|
205
231
|
}
|
|
206
232
|
/**
|
|
@@ -221,7 +247,7 @@ interface SettingsMenuProps {
|
|
|
221
247
|
declare const SettingsMenu: react.NamedExoticComponent<SettingsMenuProps>;
|
|
222
248
|
|
|
223
249
|
interface ProgressBarProps {
|
|
224
|
-
videoRef: react__default.RefObject<
|
|
250
|
+
videoRef: react__default.RefObject<HTMLMediaElement | null>;
|
|
225
251
|
playerRef: VideoPlayerRef;
|
|
226
252
|
enablePreview?: boolean;
|
|
227
253
|
thumbnailVtt?: string;
|
|
@@ -339,4 +365,4 @@ declare function parseThumbnailVtt(text: string, baseUrl?: string): ThumbnailCue
|
|
|
339
365
|
*/
|
|
340
366
|
declare function findThumbnailCue(cues: ThumbnailCue[], time: number): ThumbnailCue | null;
|
|
341
367
|
|
|
342
|
-
export { AUDIO_BANDWIDTH_THRESHOLDS, type BufferedRange, type ContextMenuItem, type ControlBarItem, index as ControlElements, Controls, type HLSQualityLevel, type PlaybackRate, type PlayerState, type SubtitleTrack, type ThumbnailCue, type VideoError, type VideoErrorCode, VideoPlayer, type VideoPlayerProps, type VideoPlayerRef, findThumbnailCue, formatTime, getMimeType, isHLSUrl, parseThumbnailVtt };
|
|
368
|
+
export { AUDIO_BANDWIDTH_THRESHOLDS, AUDIO_SWITCH_LEVELS, type BufferedRange, type ContextMenuItem, type ControlBarItem, index as ControlElements, Controls, type HLSQualityLevel, type PlaybackRate, type PlayerState, type SubtitleTrack, type ThumbnailCue, type VideoError, type VideoErrorCode, VideoPlayer, type VideoPlayerOptions, type VideoPlayerProps, type VideoPlayerRef, findThumbnailCue, formatTime, getMimeType, isHLSUrl, parseThumbnailVtt };
|
package/dist/index.d.ts
CHANGED
|
@@ -5,30 +5,57 @@ import { HlsConfig } from 'hls.js';
|
|
|
5
5
|
/**
|
|
6
6
|
* Preset bandwidth thresholds (Kbps) for automatic audio mode switching.
|
|
7
7
|
*
|
|
8
|
-
* | Preset | Kbps | Typical connection
|
|
9
|
-
*
|
|
10
|
-
* | EXTREME | 100 | 2G / Edge
|
|
11
|
-
* | POOR | 300 | Slow 3G
|
|
12
|
-
* | FAIR |
|
|
13
|
-
* | GOOD | 1500 | 4G / Wi-Fi
|
|
8
|
+
* | Preset | Kbps | Typical connection |
|
|
9
|
+
* |-----------|------|--------------------------------|
|
|
10
|
+
* | EXTREME | 100 | 2G / Edge |
|
|
11
|
+
* | POOR | 300 | Slow 3G |
|
|
12
|
+
* | FAIR | 800 | Marginal 3G ← **recommended** |
|
|
13
|
+
* | GOOD | 1500 | Weak 4G / congested Wi-Fi |
|
|
14
14
|
*
|
|
15
15
|
* Pass any of these (or a custom number) as `audioBandwidthThreshold`.
|
|
16
|
-
* Set to `0` to disable
|
|
16
|
+
* Set to `0` to disable bandwidth-based switching entirely.
|
|
17
17
|
*
|
|
18
18
|
* @example
|
|
19
19
|
* import { AUDIO_BANDWIDTH_THRESHOLDS } from "react-helios";
|
|
20
|
-
* <VideoPlayer
|
|
20
|
+
* <VideoPlayer options={{ audioBandwidthThreshold: AUDIO_BANDWIDTH_THRESHOLDS.FAIR }} />
|
|
21
21
|
*/
|
|
22
22
|
declare const AUDIO_BANDWIDTH_THRESHOLDS: {
|
|
23
23
|
/** < 100 Kbps — very poor, 2G / Edge */
|
|
24
24
|
readonly EXTREME: 100;
|
|
25
|
-
/** < 300 Kbps — poor, slow 3G
|
|
25
|
+
/** < 300 Kbps — poor, slow 3G */
|
|
26
26
|
readonly POOR: 300;
|
|
27
|
-
/** <
|
|
28
|
-
readonly FAIR:
|
|
29
|
-
/** < 1500 Kbps —
|
|
27
|
+
/** < 800 Kbps — marginal 3G ← **recommended default** */
|
|
28
|
+
readonly FAIR: 800;
|
|
29
|
+
/** < 1500 Kbps — weak 4G / congested Wi-Fi */
|
|
30
30
|
readonly GOOD: 1500;
|
|
31
31
|
};
|
|
32
|
+
/**
|
|
33
|
+
* Preset HLS quality level indices for automatic audio mode switching.
|
|
34
|
+
*
|
|
35
|
+
* When HLS.js drops to this level or below (due to poor bandwidth), the player
|
|
36
|
+
* automatically switches to audio mode. Level `0` is always the lowest quality
|
|
37
|
+
* available in the manifest.
|
|
38
|
+
*
|
|
39
|
+
* | Preset | Value | Meaning |
|
|
40
|
+
* |----------------|-------|-----------------------------------------------|
|
|
41
|
+
* | LOWEST | 0 | Switch when at the very lowest quality ← **recommended** |
|
|
42
|
+
* | SECOND_LOWEST | 1 | Switch one level above the lowest |
|
|
43
|
+
* | DISABLED | -1 | Disable level-based switching entirely |
|
|
44
|
+
*
|
|
45
|
+
* Works alongside `audioBandwidthThreshold` — whichever fires first wins.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* import { AUDIO_SWITCH_LEVELS } from "react-helios";
|
|
49
|
+
* <VideoPlayer options={{ audioModeSwitchLevel: AUDIO_SWITCH_LEVELS.LOWEST }} />
|
|
50
|
+
*/
|
|
51
|
+
declare const AUDIO_SWITCH_LEVELS: {
|
|
52
|
+
/** Switch when HLS.js is at the lowest available quality (recommended default). */
|
|
53
|
+
readonly LOWEST: 0;
|
|
54
|
+
/** Switch when HLS.js drops to the second-lowest quality. */
|
|
55
|
+
readonly SECOND_LOWEST: 1;
|
|
56
|
+
/** Disable level-based auto-switching. */
|
|
57
|
+
readonly DISABLED: -1;
|
|
58
|
+
};
|
|
32
59
|
interface BufferedRange {
|
|
33
60
|
start: number;
|
|
34
61
|
end: number;
|
|
@@ -101,83 +128,77 @@ interface ControlBarItem {
|
|
|
101
128
|
title?: string;
|
|
102
129
|
onClick: () => void;
|
|
103
130
|
}
|
|
104
|
-
interface
|
|
105
|
-
src: string;
|
|
106
|
-
poster?: string;
|
|
131
|
+
interface VideoPlayerOptions {
|
|
107
132
|
autoplay?: boolean;
|
|
108
133
|
muted?: boolean;
|
|
109
134
|
loop?: boolean;
|
|
110
|
-
controls?: boolean;
|
|
111
135
|
preload?: "none" | "metadata" | "auto";
|
|
112
136
|
playbackRates?: PlaybackRate[];
|
|
113
|
-
className?: string;
|
|
114
137
|
enableHLS?: boolean;
|
|
138
|
+
hlsConfig?: Partial<HlsConfig>;
|
|
115
139
|
enablePreview?: boolean;
|
|
116
|
-
/**
|
|
117
|
-
* URL to a WebVTT thumbnail track for sprite-sheet preview on the progress bar.
|
|
118
|
-
*
|
|
119
|
-
* The VTT file should map time ranges to sprite-sheet coordinates using the
|
|
120
|
-
* standard `#xywh=x,y,w,h` fragment format:
|
|
121
|
-
*
|
|
122
|
-
* ```
|
|
123
|
-
* WEBVTT
|
|
124
|
-
*
|
|
125
|
-
* 00:00:00.000 --> 00:00:05.000
|
|
126
|
-
* https://cdn.example.com/thumbs/storyboard0.jpg#xywh=0,0,160,90
|
|
127
|
-
* ```
|
|
128
|
-
*
|
|
129
|
-
* When provided, hovering the progress bar shows a thumbnail instead of
|
|
130
|
-
* requiring a second video decode. If omitted, only the timestamp tooltip
|
|
131
|
-
* is shown.
|
|
132
|
-
*/
|
|
133
140
|
thumbnailVtt?: string;
|
|
134
|
-
|
|
141
|
+
autoHideControls?: boolean;
|
|
135
142
|
subtitles?: SubtitleTrack[];
|
|
136
143
|
crossOrigin?: "anonymous" | "use-credentials";
|
|
137
|
-
onPlay?: () => void;
|
|
138
|
-
onPause?: () => void;
|
|
139
|
-
onEnded?: () => void;
|
|
140
|
-
onError?: (error: VideoError) => void;
|
|
141
|
-
onTimeUpdate?: (time: number) => void;
|
|
142
|
-
onDurationChange?: (duration: number) => void;
|
|
143
|
-
onBuffering?: (isBuffering: boolean) => void;
|
|
144
|
-
onTheaterModeChange?: (isTheater: boolean) => void;
|
|
145
|
-
/**
|
|
146
|
-
* Image URL or ReactNode shown as artwork in audio mode.
|
|
147
|
-
* Priority: `poster` prop → `logo` string/ReactNode → waveform-only.
|
|
148
|
-
* If a string URL is provided the image is rendered white-normalised (filter invert)
|
|
149
|
-
* so it stands out on the dark background.
|
|
150
|
-
*/
|
|
151
144
|
logo?: string | ReactNode;
|
|
152
|
-
|
|
153
|
-
* Show the headphones / audio-mode toggle button in the control bar.
|
|
154
|
-
* @default true
|
|
155
|
-
*/
|
|
145
|
+
audioSrc?: string;
|
|
156
146
|
showAudioButton?: boolean;
|
|
147
|
+
audioModeIcon?: ReactNode;
|
|
148
|
+
videoModeIcon?: ReactNode;
|
|
157
149
|
/**
|
|
158
|
-
*
|
|
159
|
-
*
|
|
150
|
+
* Custom content shown in audio mode when no `poster` is provided.
|
|
151
|
+
* Replaces the default animated-gradient + waveform fallback entirely.
|
|
152
|
+
* The `logo` prop is still rendered on top of this if also provided.
|
|
160
153
|
*/
|
|
154
|
+
audioModeFallback?: ReactNode;
|
|
155
|
+
/** Label shown next to the icon when in video mode (click → switches to audio). Default: "Audio" */
|
|
156
|
+
audioModeLabel?: string;
|
|
157
|
+
/** Label shown next to the icon when in audio mode (click → switches to video). Default: "Video" */
|
|
158
|
+
videoModeLabel?: string;
|
|
161
159
|
defaultAudioMode?: boolean;
|
|
162
160
|
/**
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
* Set to `0` to disable automatic switching.
|
|
167
|
-
* Only applies to HLS streams (where hls.js measures real segment bandwidth).
|
|
168
|
-
* @default 300 (AUDIO_BANDWIDTH_THRESHOLDS.POOR)
|
|
161
|
+
* Kbps — switch to audio mode when rolling average bandwidth drops below this value.
|
|
162
|
+
* `0` disables bandwidth-based switching. Default: `300` (slow 3G).
|
|
163
|
+
* Works alongside `audioModeSwitchLevel` — whichever fires first wins.
|
|
169
164
|
*/
|
|
170
165
|
audioBandwidthThreshold?: number;
|
|
171
|
-
/**
|
|
166
|
+
/**
|
|
167
|
+
* HLS quality level index — switch to audio mode when HLS.js drops to this level or below.
|
|
168
|
+
* `0` = lowest quality (recommended default). `-1` disables level-based switching.
|
|
169
|
+
* Works alongside `audioBandwidthThreshold` — whichever fires first wins.
|
|
170
|
+
*/
|
|
171
|
+
audioModeSwitchLevel?: number;
|
|
172
|
+
/**
|
|
173
|
+
* Milliseconds between automatic recovery probes while in auto-switched audio mode.
|
|
174
|
+
* The player briefly resumes video loading to sample bandwidth, then switches back
|
|
175
|
+
* to video if conditions have improved. Default: `30000` (30 seconds).
|
|
176
|
+
*/
|
|
177
|
+
audioModeRecoveryInterval?: number;
|
|
178
|
+
onPlay?: () => void;
|
|
179
|
+
onPause?: () => void;
|
|
180
|
+
onEnded?: () => void;
|
|
181
|
+
onError?: (error: VideoError) => void;
|
|
182
|
+
onTimeUpdate?: (time: number) => void;
|
|
183
|
+
onDurationChange?: (duration: number) => void;
|
|
184
|
+
onBuffering?: (isBuffering: boolean) => void;
|
|
185
|
+
onTheaterModeChange?: (isTheater: boolean) => void;
|
|
172
186
|
onAudioModeChange?: (isAudio: boolean) => void;
|
|
173
187
|
contextMenuItems?: ContextMenuItem[];
|
|
174
188
|
controlBarItems?: ControlBarItem[];
|
|
175
189
|
}
|
|
190
|
+
interface VideoPlayerProps {
|
|
191
|
+
src: string;
|
|
192
|
+
poster?: string;
|
|
193
|
+
className?: string;
|
|
194
|
+
controls?: boolean;
|
|
195
|
+
options?: VideoPlayerOptions;
|
|
196
|
+
}
|
|
176
197
|
|
|
177
198
|
declare const VideoPlayer: react__default.ForwardRefExoticComponent<VideoPlayerProps & react__default.RefAttributes<VideoPlayerRef>>;
|
|
178
199
|
|
|
179
200
|
interface ControlsProps {
|
|
180
|
-
videoRef: react__default.RefObject<
|
|
201
|
+
videoRef: react__default.RefObject<HTMLMediaElement | null>;
|
|
181
202
|
playerRef: VideoPlayerRef;
|
|
182
203
|
playerContainerRef: react__default.RefObject<HTMLElement | null>;
|
|
183
204
|
playbackRates: PlaybackRate[];
|
|
@@ -192,15 +213,20 @@ interface ControlsProps {
|
|
|
192
213
|
isTheaterMode: boolean;
|
|
193
214
|
isAudioMode: boolean;
|
|
194
215
|
showAudioButton: boolean;
|
|
216
|
+
audioModeIcon?: ReactNode;
|
|
217
|
+
videoModeIcon?: ReactNode;
|
|
218
|
+
audioModeLabel?: string;
|
|
219
|
+
videoModeLabel?: string;
|
|
195
220
|
isLive: boolean;
|
|
196
221
|
qualityLevels: HLSQualityLevel[];
|
|
197
222
|
currentQualityLevel: number;
|
|
198
223
|
controlBarItems?: ControlBarItem[];
|
|
224
|
+
autoHideControls: boolean;
|
|
199
225
|
}
|
|
200
|
-
declare const Controls: react__default.
|
|
226
|
+
declare const Controls: react__default.NamedExoticComponent<ControlsProps>;
|
|
201
227
|
|
|
202
228
|
interface TimeDisplayProps {
|
|
203
|
-
videoRef: React.RefObject<
|
|
229
|
+
videoRef: React.RefObject<HTMLMediaElement | null>;
|
|
204
230
|
isLive?: boolean;
|
|
205
231
|
}
|
|
206
232
|
/**
|
|
@@ -221,7 +247,7 @@ interface SettingsMenuProps {
|
|
|
221
247
|
declare const SettingsMenu: react.NamedExoticComponent<SettingsMenuProps>;
|
|
222
248
|
|
|
223
249
|
interface ProgressBarProps {
|
|
224
|
-
videoRef: react__default.RefObject<
|
|
250
|
+
videoRef: react__default.RefObject<HTMLMediaElement | null>;
|
|
225
251
|
playerRef: VideoPlayerRef;
|
|
226
252
|
enablePreview?: boolean;
|
|
227
253
|
thumbnailVtt?: string;
|
|
@@ -339,4 +365,4 @@ declare function parseThumbnailVtt(text: string, baseUrl?: string): ThumbnailCue
|
|
|
339
365
|
*/
|
|
340
366
|
declare function findThumbnailCue(cues: ThumbnailCue[], time: number): ThumbnailCue | null;
|
|
341
367
|
|
|
342
|
-
export { AUDIO_BANDWIDTH_THRESHOLDS, type BufferedRange, type ContextMenuItem, type ControlBarItem, index as ControlElements, Controls, type HLSQualityLevel, type PlaybackRate, type PlayerState, type SubtitleTrack, type ThumbnailCue, type VideoError, type VideoErrorCode, VideoPlayer, type VideoPlayerProps, type VideoPlayerRef, findThumbnailCue, formatTime, getMimeType, isHLSUrl, parseThumbnailVtt };
|
|
368
|
+
export { AUDIO_BANDWIDTH_THRESHOLDS, AUDIO_SWITCH_LEVELS, type BufferedRange, type ContextMenuItem, type ControlBarItem, index as ControlElements, Controls, type HLSQualityLevel, type PlaybackRate, type PlayerState, type SubtitleTrack, type ThumbnailCue, type VideoError, type VideoErrorCode, VideoPlayer, type VideoPlayerOptions, type VideoPlayerProps, type VideoPlayerRef, findThumbnailCue, formatTime, getMimeType, isHLSUrl, parseThumbnailVtt };
|