@lumra/react 0.1.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/dist/index.cjs +474 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +240 -0
- package/dist/index.d.ts +240 -0
- package/dist/index.js +468 -0
- package/dist/index.js.map +1 -0
- package/package.json +47 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import React$1 from 'react';
|
|
2
|
+
import { Plugin, PlayerInstance, PlayerOptions } from '@lumra/core';
|
|
3
|
+
import { LumraPurchaseOption, ChapterMark } from '@lumra/ui';
|
|
4
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
interface LumraMediaInfo {
|
|
7
|
+
title?: string;
|
|
8
|
+
creator?: {
|
|
9
|
+
name: string;
|
|
10
|
+
avatarUrl?: string;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
interface LumraTrack {
|
|
14
|
+
/** Path or URL to the .vtt file */
|
|
15
|
+
src: string;
|
|
16
|
+
kind: 'subtitles' | 'captions' | 'descriptions' | 'chapters' | 'metadata';
|
|
17
|
+
/** BCP 47 language tag, e.g. "en", "es-419" */
|
|
18
|
+
srcLang: string;
|
|
19
|
+
label: string;
|
|
20
|
+
default?: boolean;
|
|
21
|
+
}
|
|
22
|
+
interface LumraPlayerPaywall {
|
|
23
|
+
/** Whether the current user is locked out of this content */
|
|
24
|
+
locked: boolean;
|
|
25
|
+
/** Called when the user clicks "Buy now" in the paywall overlay */
|
|
26
|
+
onUnlock: () => void | Promise<void>;
|
|
27
|
+
/** Multi-option mode: Buy / Rent / Custom — pricing comes from your platform API */
|
|
28
|
+
options?: LumraPurchaseOption[];
|
|
29
|
+
/** Override title shown in paywall overlay */
|
|
30
|
+
title?: string;
|
|
31
|
+
/** Override subtitle shown in paywall overlay */
|
|
32
|
+
subtitle?: string;
|
|
33
|
+
/** Custom paywall overlay component — defaults to the built-in PaywallOverlay */
|
|
34
|
+
overlay?: React$1.ComponentType<{
|
|
35
|
+
onUnlock: () => void;
|
|
36
|
+
}>;
|
|
37
|
+
}
|
|
38
|
+
interface LumraPlayerComponents {
|
|
39
|
+
/** @deprecated Pass `paywall` prop instead — it wires the preview gate automatically */
|
|
40
|
+
Paywall?: React$1.ComponentType<{
|
|
41
|
+
onUnlock: () => void;
|
|
42
|
+
}>;
|
|
43
|
+
}
|
|
44
|
+
interface LumraPlayerProps {
|
|
45
|
+
src?: string;
|
|
46
|
+
/** Poster image shown before the video loads */
|
|
47
|
+
poster?: string;
|
|
48
|
+
autoplay?: boolean;
|
|
49
|
+
muted?: boolean;
|
|
50
|
+
volume?: number;
|
|
51
|
+
loop?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Paywall configuration. When provided:
|
|
54
|
+
* - Automatically registers `paywallGatePlugin` with `config.paywall.previewDuration`
|
|
55
|
+
* - Shows the paywall overlay after the gate fires
|
|
56
|
+
* - No manual plugin wiring needed in your component
|
|
57
|
+
*/
|
|
58
|
+
paywall?: LumraPlayerPaywall;
|
|
59
|
+
/**
|
|
60
|
+
* Title + creator info displayed as an overlay at the top of the player.
|
|
61
|
+
* Data should come from your platform API, not hardcoded here.
|
|
62
|
+
*/
|
|
63
|
+
mediaInfo?: LumraMediaInfo;
|
|
64
|
+
/**
|
|
65
|
+
* WebVTT subtitle / caption tracks.
|
|
66
|
+
* Maps directly to HTML <track> elements.
|
|
67
|
+
*/
|
|
68
|
+
tracks?: LumraTrack[];
|
|
69
|
+
/**
|
|
70
|
+
* Chapter markers shown as dividers on the seek bar.
|
|
71
|
+
* Load from your platform API — e.g. `video.chapters` from your DB.
|
|
72
|
+
*/
|
|
73
|
+
chapters?: ChapterMark[];
|
|
74
|
+
/**
|
|
75
|
+
* Normalized 0-1 heatmap values (one per seek-bar segment).
|
|
76
|
+
* Supply via heatmapPlugin's onData callback or directly from your API.
|
|
77
|
+
*/
|
|
78
|
+
heatmapData?: number[];
|
|
79
|
+
/**
|
|
80
|
+
* Render only the <video> element with no built-in controls or overlays.
|
|
81
|
+
* Use when you want full UI control.
|
|
82
|
+
*/
|
|
83
|
+
headless?: boolean;
|
|
84
|
+
/** Additional plugins (analytics, custom gates, etc.) */
|
|
85
|
+
plugins?: Plugin[];
|
|
86
|
+
/** @deprecated Use `paywall` prop for paywall overlay */
|
|
87
|
+
components?: LumraPlayerComponents;
|
|
88
|
+
className?: string;
|
|
89
|
+
style?: React$1.CSSProperties;
|
|
90
|
+
onPlay?: () => void;
|
|
91
|
+
onPause?: () => void;
|
|
92
|
+
onEnded?: () => void;
|
|
93
|
+
onTimeUpdate?: (currentTime: number, duration: number) => void;
|
|
94
|
+
onError?: (code: number, message: string) => void;
|
|
95
|
+
}
|
|
96
|
+
declare const LumraPlayer: React$1.ForwardRefExoticComponent<LumraPlayerProps & React$1.RefAttributes<PlayerInstance>>;
|
|
97
|
+
|
|
98
|
+
interface UsePlayerOptions extends Omit<PlayerOptions, 'target'> {
|
|
99
|
+
}
|
|
100
|
+
interface UsePlayerReturn {
|
|
101
|
+
player: PlayerInstance | null;
|
|
102
|
+
videoRef: React.RefObject<HTMLVideoElement>;
|
|
103
|
+
paused: boolean;
|
|
104
|
+
currentTime: number;
|
|
105
|
+
duration: number;
|
|
106
|
+
volume: number;
|
|
107
|
+
muted: boolean;
|
|
108
|
+
}
|
|
109
|
+
declare function usePlayer(options?: UsePlayerOptions): UsePlayerReturn;
|
|
110
|
+
|
|
111
|
+
interface LumraTheme {
|
|
112
|
+
/** Progress bar fill + scrubber thumb colour (default: '#ffffff') */
|
|
113
|
+
accentColor?: string;
|
|
114
|
+
/** Icon + time display colour (default: '#ffffff') */
|
|
115
|
+
textColor?: string;
|
|
116
|
+
/** Controls bar background — any CSS value (default: black gradient) */
|
|
117
|
+
controlsBg?: string;
|
|
118
|
+
/** Player container border-radius (default: '0px') */
|
|
119
|
+
borderRadius?: string;
|
|
120
|
+
}
|
|
121
|
+
interface LumraControlsConfig {
|
|
122
|
+
/** Show play/pause button (default: true) */
|
|
123
|
+
play?: boolean;
|
|
124
|
+
/** Show seek bar (default: true) */
|
|
125
|
+
progress?: boolean;
|
|
126
|
+
/** Show volume control (default: true) */
|
|
127
|
+
volume?: boolean;
|
|
128
|
+
/** Show fullscreen button (default: true) */
|
|
129
|
+
fullscreen?: boolean;
|
|
130
|
+
/** Show Picture-in-Picture button (default: true) */
|
|
131
|
+
pip?: boolean;
|
|
132
|
+
/** Show current / duration timestamp (default: true) */
|
|
133
|
+
time?: boolean;
|
|
134
|
+
/** Hide toolbar after inactivity (default: true) */
|
|
135
|
+
autoHide?: boolean;
|
|
136
|
+
/** Milliseconds of inactivity before toolbar hides (default: 3000) */
|
|
137
|
+
autoHideDelay?: number;
|
|
138
|
+
}
|
|
139
|
+
interface LumraBehaviorConfig {
|
|
140
|
+
/** Disable right-click + nodownload attribute to discourage saving (default: false) */
|
|
141
|
+
blockDownload?: boolean;
|
|
142
|
+
autoplay?: boolean;
|
|
143
|
+
muted?: boolean;
|
|
144
|
+
loop?: boolean;
|
|
145
|
+
}
|
|
146
|
+
interface LumraPaywallConfig {
|
|
147
|
+
/**
|
|
148
|
+
* Seconds of free preview before the gate fires and the paywall overlay appears.
|
|
149
|
+
* Controlled here so you never touch App.tsx — just change this number.
|
|
150
|
+
* (default: 5)
|
|
151
|
+
*/
|
|
152
|
+
previewDuration?: number;
|
|
153
|
+
}
|
|
154
|
+
interface LumraAdConfig {
|
|
155
|
+
/**
|
|
156
|
+
* VAST 2.0 / 3.0 tag URL — the plugin fetches and parses the XML automatically.
|
|
157
|
+
* Supply either `vast` or `src`, not both.
|
|
158
|
+
*/
|
|
159
|
+
vast?: string;
|
|
160
|
+
/** Direct video URL (MP4 / HLS) — bypasses VAST, used as a simple pre-baked ad */
|
|
161
|
+
src?: string;
|
|
162
|
+
/** Seconds of ad playback before the Skip button appears. 0 = not skippable. */
|
|
163
|
+
skipAfter?: number;
|
|
164
|
+
/** Override the click-through URL (ignored when VAST provides one) */
|
|
165
|
+
clickThroughUrl?: string;
|
|
166
|
+
}
|
|
167
|
+
interface LumraMidRollConfig extends LumraAdConfig {
|
|
168
|
+
/** Content timestamp (in seconds) at which this mid-roll fires */
|
|
169
|
+
at: number;
|
|
170
|
+
}
|
|
171
|
+
interface LumraAdsConfig {
|
|
172
|
+
/**
|
|
173
|
+
* Lumra Ads premium license key.
|
|
174
|
+
* Format: LUMRA-ADS-XXXXXXXX-XXXXXXXX
|
|
175
|
+
* Obtain a key at https://lumra.dev/premium
|
|
176
|
+
*/
|
|
177
|
+
licenseKey: string;
|
|
178
|
+
/** Optional server endpoint to verify the license key */
|
|
179
|
+
verifyEndpoint?: string;
|
|
180
|
+
/** Ad that plays before the main content */
|
|
181
|
+
preRoll?: LumraAdConfig;
|
|
182
|
+
/** One or more ads that interrupt the main content at specific timestamps */
|
|
183
|
+
midRoll?: LumraMidRollConfig[];
|
|
184
|
+
/** Ad that plays after the main content ends */
|
|
185
|
+
postRoll?: LumraAdConfig;
|
|
186
|
+
}
|
|
187
|
+
interface LumraStorageConfig {
|
|
188
|
+
/**
|
|
189
|
+
* Base URL prepended to any relative `src` value.
|
|
190
|
+
* Swap between local dev and production CDN by changing this one line.
|
|
191
|
+
*
|
|
192
|
+
* @example
|
|
193
|
+
* // local dev
|
|
194
|
+
* baseUrl: 'http://localhost:9000/videos'
|
|
195
|
+
* // production
|
|
196
|
+
* baseUrl: 'https://your-cdn.com/videos'
|
|
197
|
+
*/
|
|
198
|
+
baseUrl?: string;
|
|
199
|
+
}
|
|
200
|
+
interface LumraCloudConfig {
|
|
201
|
+
/**
|
|
202
|
+
* Called before every video load — return a signed or proxied URL.
|
|
203
|
+
* Works with AWS S3, Cloudflare R2 / Stream, Mux, Bunny CDN, etc.
|
|
204
|
+
*
|
|
205
|
+
* @example
|
|
206
|
+
* // AWS S3 presigned URL (via your own API)
|
|
207
|
+
* signUrl: async (src) => {
|
|
208
|
+
* const res = await fetch(`/api/sign-url?src=${encodeURIComponent(src)}`)
|
|
209
|
+
* const { url } = await res.json()
|
|
210
|
+
* return url
|
|
211
|
+
* }
|
|
212
|
+
*
|
|
213
|
+
* @example
|
|
214
|
+
* // Cloudflare Stream signed URL
|
|
215
|
+
* signUrl: async (src) => {
|
|
216
|
+
* const res = await fetch('/api/cf-sign', { method: 'POST', body: JSON.stringify({ src }) })
|
|
217
|
+
* const { url } = await res.json()
|
|
218
|
+
* return url
|
|
219
|
+
* }
|
|
220
|
+
*/
|
|
221
|
+
signUrl?: (src: string) => Promise<string>;
|
|
222
|
+
}
|
|
223
|
+
interface LumraConfig {
|
|
224
|
+
theme?: LumraTheme;
|
|
225
|
+
controls?: LumraControlsConfig;
|
|
226
|
+
behavior?: LumraBehaviorConfig;
|
|
227
|
+
paywall?: LumraPaywallConfig;
|
|
228
|
+
ads?: LumraAdsConfig;
|
|
229
|
+
storage?: LumraStorageConfig;
|
|
230
|
+
cloud?: LumraCloudConfig;
|
|
231
|
+
}
|
|
232
|
+
/** Type-safe helper — returns the config unchanged but provides IDE autocomplete */
|
|
233
|
+
declare function defineLumraConfig(config: LumraConfig): LumraConfig;
|
|
234
|
+
declare function LumraConfigProvider({ config, children, }: {
|
|
235
|
+
config: LumraConfig;
|
|
236
|
+
children: React$1.ReactNode;
|
|
237
|
+
}): react_jsx_runtime.JSX.Element;
|
|
238
|
+
declare function useLumraConfig(): LumraConfig;
|
|
239
|
+
|
|
240
|
+
export { type LumraAdConfig, type LumraAdsConfig, type LumraBehaviorConfig, type LumraCloudConfig, type LumraConfig, LumraConfigProvider, type LumraControlsConfig, type LumraMediaInfo, type LumraMidRollConfig, type LumraPaywallConfig, LumraPlayer, type LumraPlayerComponents, type LumraPlayerPaywall, type LumraPlayerProps, type LumraStorageConfig, type LumraTheme, type LumraTrack, type UsePlayerOptions, type UsePlayerReturn, defineLumraConfig, useLumraConfig, usePlayer };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import React$1 from 'react';
|
|
2
|
+
import { Plugin, PlayerInstance, PlayerOptions } from '@lumra/core';
|
|
3
|
+
import { LumraPurchaseOption, ChapterMark } from '@lumra/ui';
|
|
4
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
interface LumraMediaInfo {
|
|
7
|
+
title?: string;
|
|
8
|
+
creator?: {
|
|
9
|
+
name: string;
|
|
10
|
+
avatarUrl?: string;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
interface LumraTrack {
|
|
14
|
+
/** Path or URL to the .vtt file */
|
|
15
|
+
src: string;
|
|
16
|
+
kind: 'subtitles' | 'captions' | 'descriptions' | 'chapters' | 'metadata';
|
|
17
|
+
/** BCP 47 language tag, e.g. "en", "es-419" */
|
|
18
|
+
srcLang: string;
|
|
19
|
+
label: string;
|
|
20
|
+
default?: boolean;
|
|
21
|
+
}
|
|
22
|
+
interface LumraPlayerPaywall {
|
|
23
|
+
/** Whether the current user is locked out of this content */
|
|
24
|
+
locked: boolean;
|
|
25
|
+
/** Called when the user clicks "Buy now" in the paywall overlay */
|
|
26
|
+
onUnlock: () => void | Promise<void>;
|
|
27
|
+
/** Multi-option mode: Buy / Rent / Custom — pricing comes from your platform API */
|
|
28
|
+
options?: LumraPurchaseOption[];
|
|
29
|
+
/** Override title shown in paywall overlay */
|
|
30
|
+
title?: string;
|
|
31
|
+
/** Override subtitle shown in paywall overlay */
|
|
32
|
+
subtitle?: string;
|
|
33
|
+
/** Custom paywall overlay component — defaults to the built-in PaywallOverlay */
|
|
34
|
+
overlay?: React$1.ComponentType<{
|
|
35
|
+
onUnlock: () => void;
|
|
36
|
+
}>;
|
|
37
|
+
}
|
|
38
|
+
interface LumraPlayerComponents {
|
|
39
|
+
/** @deprecated Pass `paywall` prop instead — it wires the preview gate automatically */
|
|
40
|
+
Paywall?: React$1.ComponentType<{
|
|
41
|
+
onUnlock: () => void;
|
|
42
|
+
}>;
|
|
43
|
+
}
|
|
44
|
+
interface LumraPlayerProps {
|
|
45
|
+
src?: string;
|
|
46
|
+
/** Poster image shown before the video loads */
|
|
47
|
+
poster?: string;
|
|
48
|
+
autoplay?: boolean;
|
|
49
|
+
muted?: boolean;
|
|
50
|
+
volume?: number;
|
|
51
|
+
loop?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Paywall configuration. When provided:
|
|
54
|
+
* - Automatically registers `paywallGatePlugin` with `config.paywall.previewDuration`
|
|
55
|
+
* - Shows the paywall overlay after the gate fires
|
|
56
|
+
* - No manual plugin wiring needed in your component
|
|
57
|
+
*/
|
|
58
|
+
paywall?: LumraPlayerPaywall;
|
|
59
|
+
/**
|
|
60
|
+
* Title + creator info displayed as an overlay at the top of the player.
|
|
61
|
+
* Data should come from your platform API, not hardcoded here.
|
|
62
|
+
*/
|
|
63
|
+
mediaInfo?: LumraMediaInfo;
|
|
64
|
+
/**
|
|
65
|
+
* WebVTT subtitle / caption tracks.
|
|
66
|
+
* Maps directly to HTML <track> elements.
|
|
67
|
+
*/
|
|
68
|
+
tracks?: LumraTrack[];
|
|
69
|
+
/**
|
|
70
|
+
* Chapter markers shown as dividers on the seek bar.
|
|
71
|
+
* Load from your platform API — e.g. `video.chapters` from your DB.
|
|
72
|
+
*/
|
|
73
|
+
chapters?: ChapterMark[];
|
|
74
|
+
/**
|
|
75
|
+
* Normalized 0-1 heatmap values (one per seek-bar segment).
|
|
76
|
+
* Supply via heatmapPlugin's onData callback or directly from your API.
|
|
77
|
+
*/
|
|
78
|
+
heatmapData?: number[];
|
|
79
|
+
/**
|
|
80
|
+
* Render only the <video> element with no built-in controls or overlays.
|
|
81
|
+
* Use when you want full UI control.
|
|
82
|
+
*/
|
|
83
|
+
headless?: boolean;
|
|
84
|
+
/** Additional plugins (analytics, custom gates, etc.) */
|
|
85
|
+
plugins?: Plugin[];
|
|
86
|
+
/** @deprecated Use `paywall` prop for paywall overlay */
|
|
87
|
+
components?: LumraPlayerComponents;
|
|
88
|
+
className?: string;
|
|
89
|
+
style?: React$1.CSSProperties;
|
|
90
|
+
onPlay?: () => void;
|
|
91
|
+
onPause?: () => void;
|
|
92
|
+
onEnded?: () => void;
|
|
93
|
+
onTimeUpdate?: (currentTime: number, duration: number) => void;
|
|
94
|
+
onError?: (code: number, message: string) => void;
|
|
95
|
+
}
|
|
96
|
+
declare const LumraPlayer: React$1.ForwardRefExoticComponent<LumraPlayerProps & React$1.RefAttributes<PlayerInstance>>;
|
|
97
|
+
|
|
98
|
+
interface UsePlayerOptions extends Omit<PlayerOptions, 'target'> {
|
|
99
|
+
}
|
|
100
|
+
interface UsePlayerReturn {
|
|
101
|
+
player: PlayerInstance | null;
|
|
102
|
+
videoRef: React.RefObject<HTMLVideoElement>;
|
|
103
|
+
paused: boolean;
|
|
104
|
+
currentTime: number;
|
|
105
|
+
duration: number;
|
|
106
|
+
volume: number;
|
|
107
|
+
muted: boolean;
|
|
108
|
+
}
|
|
109
|
+
declare function usePlayer(options?: UsePlayerOptions): UsePlayerReturn;
|
|
110
|
+
|
|
111
|
+
interface LumraTheme {
|
|
112
|
+
/** Progress bar fill + scrubber thumb colour (default: '#ffffff') */
|
|
113
|
+
accentColor?: string;
|
|
114
|
+
/** Icon + time display colour (default: '#ffffff') */
|
|
115
|
+
textColor?: string;
|
|
116
|
+
/** Controls bar background — any CSS value (default: black gradient) */
|
|
117
|
+
controlsBg?: string;
|
|
118
|
+
/** Player container border-radius (default: '0px') */
|
|
119
|
+
borderRadius?: string;
|
|
120
|
+
}
|
|
121
|
+
interface LumraControlsConfig {
|
|
122
|
+
/** Show play/pause button (default: true) */
|
|
123
|
+
play?: boolean;
|
|
124
|
+
/** Show seek bar (default: true) */
|
|
125
|
+
progress?: boolean;
|
|
126
|
+
/** Show volume control (default: true) */
|
|
127
|
+
volume?: boolean;
|
|
128
|
+
/** Show fullscreen button (default: true) */
|
|
129
|
+
fullscreen?: boolean;
|
|
130
|
+
/** Show Picture-in-Picture button (default: true) */
|
|
131
|
+
pip?: boolean;
|
|
132
|
+
/** Show current / duration timestamp (default: true) */
|
|
133
|
+
time?: boolean;
|
|
134
|
+
/** Hide toolbar after inactivity (default: true) */
|
|
135
|
+
autoHide?: boolean;
|
|
136
|
+
/** Milliseconds of inactivity before toolbar hides (default: 3000) */
|
|
137
|
+
autoHideDelay?: number;
|
|
138
|
+
}
|
|
139
|
+
interface LumraBehaviorConfig {
|
|
140
|
+
/** Disable right-click + nodownload attribute to discourage saving (default: false) */
|
|
141
|
+
blockDownload?: boolean;
|
|
142
|
+
autoplay?: boolean;
|
|
143
|
+
muted?: boolean;
|
|
144
|
+
loop?: boolean;
|
|
145
|
+
}
|
|
146
|
+
interface LumraPaywallConfig {
|
|
147
|
+
/**
|
|
148
|
+
* Seconds of free preview before the gate fires and the paywall overlay appears.
|
|
149
|
+
* Controlled here so you never touch App.tsx — just change this number.
|
|
150
|
+
* (default: 5)
|
|
151
|
+
*/
|
|
152
|
+
previewDuration?: number;
|
|
153
|
+
}
|
|
154
|
+
interface LumraAdConfig {
|
|
155
|
+
/**
|
|
156
|
+
* VAST 2.0 / 3.0 tag URL — the plugin fetches and parses the XML automatically.
|
|
157
|
+
* Supply either `vast` or `src`, not both.
|
|
158
|
+
*/
|
|
159
|
+
vast?: string;
|
|
160
|
+
/** Direct video URL (MP4 / HLS) — bypasses VAST, used as a simple pre-baked ad */
|
|
161
|
+
src?: string;
|
|
162
|
+
/** Seconds of ad playback before the Skip button appears. 0 = not skippable. */
|
|
163
|
+
skipAfter?: number;
|
|
164
|
+
/** Override the click-through URL (ignored when VAST provides one) */
|
|
165
|
+
clickThroughUrl?: string;
|
|
166
|
+
}
|
|
167
|
+
interface LumraMidRollConfig extends LumraAdConfig {
|
|
168
|
+
/** Content timestamp (in seconds) at which this mid-roll fires */
|
|
169
|
+
at: number;
|
|
170
|
+
}
|
|
171
|
+
interface LumraAdsConfig {
|
|
172
|
+
/**
|
|
173
|
+
* Lumra Ads premium license key.
|
|
174
|
+
* Format: LUMRA-ADS-XXXXXXXX-XXXXXXXX
|
|
175
|
+
* Obtain a key at https://lumra.dev/premium
|
|
176
|
+
*/
|
|
177
|
+
licenseKey: string;
|
|
178
|
+
/** Optional server endpoint to verify the license key */
|
|
179
|
+
verifyEndpoint?: string;
|
|
180
|
+
/** Ad that plays before the main content */
|
|
181
|
+
preRoll?: LumraAdConfig;
|
|
182
|
+
/** One or more ads that interrupt the main content at specific timestamps */
|
|
183
|
+
midRoll?: LumraMidRollConfig[];
|
|
184
|
+
/** Ad that plays after the main content ends */
|
|
185
|
+
postRoll?: LumraAdConfig;
|
|
186
|
+
}
|
|
187
|
+
interface LumraStorageConfig {
|
|
188
|
+
/**
|
|
189
|
+
* Base URL prepended to any relative `src` value.
|
|
190
|
+
* Swap between local dev and production CDN by changing this one line.
|
|
191
|
+
*
|
|
192
|
+
* @example
|
|
193
|
+
* // local dev
|
|
194
|
+
* baseUrl: 'http://localhost:9000/videos'
|
|
195
|
+
* // production
|
|
196
|
+
* baseUrl: 'https://your-cdn.com/videos'
|
|
197
|
+
*/
|
|
198
|
+
baseUrl?: string;
|
|
199
|
+
}
|
|
200
|
+
interface LumraCloudConfig {
|
|
201
|
+
/**
|
|
202
|
+
* Called before every video load — return a signed or proxied URL.
|
|
203
|
+
* Works with AWS S3, Cloudflare R2 / Stream, Mux, Bunny CDN, etc.
|
|
204
|
+
*
|
|
205
|
+
* @example
|
|
206
|
+
* // AWS S3 presigned URL (via your own API)
|
|
207
|
+
* signUrl: async (src) => {
|
|
208
|
+
* const res = await fetch(`/api/sign-url?src=${encodeURIComponent(src)}`)
|
|
209
|
+
* const { url } = await res.json()
|
|
210
|
+
* return url
|
|
211
|
+
* }
|
|
212
|
+
*
|
|
213
|
+
* @example
|
|
214
|
+
* // Cloudflare Stream signed URL
|
|
215
|
+
* signUrl: async (src) => {
|
|
216
|
+
* const res = await fetch('/api/cf-sign', { method: 'POST', body: JSON.stringify({ src }) })
|
|
217
|
+
* const { url } = await res.json()
|
|
218
|
+
* return url
|
|
219
|
+
* }
|
|
220
|
+
*/
|
|
221
|
+
signUrl?: (src: string) => Promise<string>;
|
|
222
|
+
}
|
|
223
|
+
interface LumraConfig {
|
|
224
|
+
theme?: LumraTheme;
|
|
225
|
+
controls?: LumraControlsConfig;
|
|
226
|
+
behavior?: LumraBehaviorConfig;
|
|
227
|
+
paywall?: LumraPaywallConfig;
|
|
228
|
+
ads?: LumraAdsConfig;
|
|
229
|
+
storage?: LumraStorageConfig;
|
|
230
|
+
cloud?: LumraCloudConfig;
|
|
231
|
+
}
|
|
232
|
+
/** Type-safe helper — returns the config unchanged but provides IDE autocomplete */
|
|
233
|
+
declare function defineLumraConfig(config: LumraConfig): LumraConfig;
|
|
234
|
+
declare function LumraConfigProvider({ config, children, }: {
|
|
235
|
+
config: LumraConfig;
|
|
236
|
+
children: React$1.ReactNode;
|
|
237
|
+
}): react_jsx_runtime.JSX.Element;
|
|
238
|
+
declare function useLumraConfig(): LumraConfig;
|
|
239
|
+
|
|
240
|
+
export { type LumraAdConfig, type LumraAdsConfig, type LumraBehaviorConfig, type LumraCloudConfig, type LumraConfig, LumraConfigProvider, type LumraControlsConfig, type LumraMediaInfo, type LumraMidRollConfig, type LumraPaywallConfig, LumraPlayer, type LumraPlayerComponents, type LumraPlayerPaywall, type LumraPlayerProps, type LumraStorageConfig, type LumraTheme, type LumraTrack, type UsePlayerOptions, type UsePlayerReturn, defineLumraConfig, useLumraConfig, usePlayer };
|