@glitchlab/react-video-player 1.4.1 → 1.5.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 +113 -1
- package/dist/index.cjs +3 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +126 -2
- package/dist/index.mjs +1006 -656
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,26 @@ export declare interface AudioTrackInfo {
|
|
|
16
16
|
lang?: string;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Chapter (cue marker) support. Chapters segment the timeline into named
|
|
21
|
+
* sections — useful for tutorials and long-form content. They can be supplied
|
|
22
|
+
* inline or as a WebVTT chapters file:
|
|
23
|
+
*
|
|
24
|
+
* 00:00:00.000 --> 00:02:30.000
|
|
25
|
+
* Introduction
|
|
26
|
+
*
|
|
27
|
+
* 00:02:30.000 --> 00:10:00.000
|
|
28
|
+
* Getting started
|
|
29
|
+
*/
|
|
30
|
+
export declare interface Chapter {
|
|
31
|
+
/** Chapter start time, in seconds. */
|
|
32
|
+
start: number;
|
|
33
|
+
/** Chapter end time, in seconds. */
|
|
34
|
+
end: number;
|
|
35
|
+
/** Human-readable chapter title. */
|
|
36
|
+
title: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
19
39
|
declare type DeviceMode = "desktop" | "mobile";
|
|
20
40
|
|
|
21
41
|
/**
|
|
@@ -37,6 +57,24 @@ export declare function parseYouTubeId(input: string): string | null;
|
|
|
37
57
|
/** Extract a `t`/`start` timestamp (in seconds) from a YouTube URL, if present. */
|
|
38
58
|
export declare function parseYouTubeStart(input: string): number | null;
|
|
39
59
|
|
|
60
|
+
/** A single entry in a {@link VideoPlayerWrapperProps.playlist}. */
|
|
61
|
+
export declare interface PlaylistItem {
|
|
62
|
+
/** Video source URL. `.m3u8` URLs are routed through hls.js automatically. */
|
|
63
|
+
src: string;
|
|
64
|
+
/** Poster image for this item. Falls back to the player-level `poster`. */
|
|
65
|
+
poster?: string;
|
|
66
|
+
/** Optional human-readable title for this item. */
|
|
67
|
+
title?: string;
|
|
68
|
+
/** Per-item WebVTT storyboard URL for seek-bar thumbnails. */
|
|
69
|
+
thumbnails?: string;
|
|
70
|
+
/** Per-item chapters (WebVTT URL or inline array). */
|
|
71
|
+
chapters?: string | Array<{
|
|
72
|
+
start: number;
|
|
73
|
+
end?: number;
|
|
74
|
+
title: string;
|
|
75
|
+
}>;
|
|
76
|
+
}
|
|
77
|
+
|
|
40
78
|
/**
|
|
41
79
|
* A normalized quality-level descriptor for an HLS stream. `index` maps to a
|
|
42
80
|
* `hls.js` level index; the special index `-1` represents "Auto" (adaptive
|
|
@@ -54,10 +92,26 @@ export declare interface QualityLevelInfo {
|
|
|
54
92
|
export declare const ReactVideoPlayer: default_2.FC<ReactVideoPlayerProps>;
|
|
55
93
|
|
|
56
94
|
export declare interface ReactVideoPlayerProps {
|
|
57
|
-
/**
|
|
58
|
-
|
|
95
|
+
/**
|
|
96
|
+
* Video source URL. `.m3u8` URLs are routed through hls.js automatically.
|
|
97
|
+
* Optional when `playlist` is supplied — the playlist drives the source.
|
|
98
|
+
*/
|
|
99
|
+
src?: string;
|
|
59
100
|
/** Poster image shown before playback. */
|
|
60
101
|
poster?: string;
|
|
102
|
+
/**
|
|
103
|
+
* A list of videos to play in sequence. When provided, the player plays
|
|
104
|
+
* the item at `defaultIndex` and auto-advances on end. Prev/next buttons
|
|
105
|
+
* appear in the custom control bar. Each item can carry its own poster,
|
|
106
|
+
* thumbnails and chapters. Takes precedence over `src`.
|
|
107
|
+
*/
|
|
108
|
+
playlist?: PlaylistItem[];
|
|
109
|
+
/** Index of the playlist item to start on. Defaults to `0`. */
|
|
110
|
+
defaultIndex?: number;
|
|
111
|
+
/** Auto-advance to the next playlist item when one ends. Defaults to `true`. */
|
|
112
|
+
autoAdvance?: boolean;
|
|
113
|
+
/** Called when the active playlist item changes. */
|
|
114
|
+
onPlaylistChange?: (index: number, item: PlaylistItem) => void;
|
|
61
115
|
/** Show the desktop/mobile toggle pill in the top-left. Defaults to `true`. */
|
|
62
116
|
showDeviceToggle?: boolean;
|
|
63
117
|
/** Initial device mode. Defaults to `"desktop"`. */
|
|
@@ -104,6 +158,45 @@ export declare interface ReactVideoPlayerProps {
|
|
|
104
158
|
* to avoid tearing down and rebuilding the HLS instance on each render.
|
|
105
159
|
*/
|
|
106
160
|
hlsConfig?: HlsConfig;
|
|
161
|
+
/**
|
|
162
|
+
* URL of a WebVTT storyboard file for seek-bar thumbnail previews. Each cue
|
|
163
|
+
* points at a sprite region (`sprite.jpg#xywh=x,y,w,h`). Hovering the seek
|
|
164
|
+
* bar shows the matching frame. Only used with the custom control bar.
|
|
165
|
+
*/
|
|
166
|
+
thumbnails?: string;
|
|
167
|
+
/**
|
|
168
|
+
* Timeline chapters. Either a URL of a WebVTT chapters file, or an inline
|
|
169
|
+
* array of `{ start, title }` (with optional `end`). Chapters add tick
|
|
170
|
+
* marks to the seek bar and the chapter title to the hover preview. Only
|
|
171
|
+
* used with the custom control bar.
|
|
172
|
+
*/
|
|
173
|
+
chapters?: string | Array<{
|
|
174
|
+
start: number;
|
|
175
|
+
end?: number;
|
|
176
|
+
title: string;
|
|
177
|
+
}>;
|
|
178
|
+
/** Fired when playback starts or resumes. */
|
|
179
|
+
onPlay?: () => void;
|
|
180
|
+
/** Fired when playback is paused. */
|
|
181
|
+
onPause?: () => void;
|
|
182
|
+
/** Fired when the current video reaches its end. */
|
|
183
|
+
onEnded?: () => void;
|
|
184
|
+
/**
|
|
185
|
+
* Fired on every `timeupdate` (~4×/sec) with the current time and total
|
|
186
|
+
* duration, both in seconds. Use for progress bars or analytics.
|
|
187
|
+
*/
|
|
188
|
+
onTimeUpdate?: (currentTime: number, duration: number) => void;
|
|
189
|
+
/** Fired after a seek completes, with the new time in seconds. */
|
|
190
|
+
onSeeked?: (currentTime: number) => void;
|
|
191
|
+
/** Fired when volume or mute state changes. */
|
|
192
|
+
onVolumeChange?: (volume: number, muted: boolean) => void;
|
|
193
|
+
/**
|
|
194
|
+
* Fired once each time watch progress crosses 25%, 50%, 75% and 100% of
|
|
195
|
+
* the video. Handy for completion analytics without your own timer.
|
|
196
|
+
*/
|
|
197
|
+
onMilestone?: (percent: 25 | 50 | 75 | 100) => void;
|
|
198
|
+
/** Fired when the underlying media element reports an error. */
|
|
199
|
+
onError?: () => void;
|
|
107
200
|
/**
|
|
108
201
|
* Children rendered inside the underlying `<video>` element. Use this to
|
|
109
202
|
* supply `<track>` elements for captions, subtitles, etc.
|
|
@@ -111,6 +204,37 @@ export declare interface ReactVideoPlayerProps {
|
|
|
111
204
|
children?: default_2.ReactNode;
|
|
112
205
|
}
|
|
113
206
|
|
|
207
|
+
/**
|
|
208
|
+
* Parsing for WebVTT storyboard/thumbnail tracks — the format YouTube, Vimeo
|
|
209
|
+
* and most players use for seek-bar previews. Each cue maps a time range to a
|
|
210
|
+
* region of a sprite image:
|
|
211
|
+
*
|
|
212
|
+
* 00:00:00.000 --> 00:00:05.000
|
|
213
|
+
* sprite.jpg#xywh=0,0,160,90
|
|
214
|
+
*
|
|
215
|
+
* The `#xywh=` fragment is optional. Without it, the whole image is used.
|
|
216
|
+
*/
|
|
217
|
+
export declare interface ThumbnailCue {
|
|
218
|
+
/** Cue start time, in seconds. */
|
|
219
|
+
start: number;
|
|
220
|
+
/** Cue end time, in seconds. */
|
|
221
|
+
end: number;
|
|
222
|
+
/** Absolute URL of the sprite (or standalone) image. */
|
|
223
|
+
url: string;
|
|
224
|
+
/** Crop region within the image, in pixels. */
|
|
225
|
+
x: number;
|
|
226
|
+
y: number;
|
|
227
|
+
w: number;
|
|
228
|
+
h: number;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/** A parsed thumbnail track plus a time → cue lookup. */
|
|
232
|
+
export declare interface ThumbnailTrack {
|
|
233
|
+
cues: ThumbnailCue[];
|
|
234
|
+
/** Returns the cue covering `time`, or the nearest one. `null` if empty. */
|
|
235
|
+
cueAt(time: number): ThumbnailCue | null;
|
|
236
|
+
}
|
|
237
|
+
|
|
114
238
|
declare interface YouTubeEmbedOptions {
|
|
115
239
|
/** Start playback immediately. Forces `mute` on, since browsers block sound-on autoplay. */
|
|
116
240
|
autoPlay?: boolean;
|