@mottosports/motto-video-player 1.0.1-rc.7 → 1.0.1-rc.8
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 +158 -161
- package/dist/index.d.mts +11 -42
- package/dist/index.d.ts +11 -42
- package/dist/index.js +125 -417
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +109 -396
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Motto Video Player
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
React video player component for the Motto platform, powered by Shaka Player with TanStack Query integration.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
@@ -17,220 +17,217 @@ A modern, feature-rich video player built on top of Shaka Player with React supp
|
|
|
17
17
|
## Installation
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
|
-
npm install @motto/video-player
|
|
21
|
-
# or
|
|
22
|
-
yarn add @motto/video-player
|
|
23
|
-
# or
|
|
24
|
-
pnpm add @motto/video-player
|
|
20
|
+
npm install @motto-ui-components/motto-video-player @tanstack/react-query
|
|
25
21
|
```
|
|
26
22
|
|
|
27
|
-
##
|
|
23
|
+
## Quick Start
|
|
28
24
|
|
|
29
|
-
|
|
30
|
-
import { Player } from '@motto/video-player';
|
|
25
|
+
### Setup QueryClient (Required for Video wrapper)
|
|
31
26
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
<Player
|
|
35
|
-
src="https://example.com/video.m3u8"
|
|
36
|
-
autoPlay={false}
|
|
37
|
-
controls={true}
|
|
38
|
-
width={800}
|
|
39
|
-
height={450}
|
|
40
|
-
/>
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
## Next.js Usage (SSR Support)
|
|
46
|
-
|
|
47
|
-
If you're using Next.js, you need to handle server-side rendering (SSR) since Shaka Player requires browser APIs. Here are three approaches:
|
|
48
|
-
|
|
49
|
-
### Option 1: Using next/dynamic (Recommended)
|
|
27
|
+
```jsx
|
|
28
|
+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
50
29
|
|
|
51
|
-
|
|
52
|
-
import dynamic from 'next/dynamic';
|
|
30
|
+
const queryClient = new QueryClient();
|
|
53
31
|
|
|
54
|
-
|
|
55
|
-
() => import('@motto/video-player').then((mod) => ({ default: mod.Player })),
|
|
56
|
-
{
|
|
57
|
-
ssr: false,
|
|
58
|
-
loading: () => <div>Loading player...</div>
|
|
59
|
-
}
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
function MyVideoPage() {
|
|
32
|
+
function App() {
|
|
63
33
|
return (
|
|
64
|
-
<
|
|
65
|
-
<
|
|
66
|
-
|
|
67
|
-
src="https://example.com/video.m3u8"
|
|
68
|
-
autoPlay={false}
|
|
69
|
-
controls={true}
|
|
70
|
-
width={800}
|
|
71
|
-
height={450}
|
|
72
|
-
/>
|
|
73
|
-
</div>
|
|
34
|
+
<QueryClientProvider client={queryClient}>
|
|
35
|
+
<YourComponents />
|
|
36
|
+
</QueryClientProvider>
|
|
74
37
|
);
|
|
75
38
|
}
|
|
76
39
|
```
|
|
77
40
|
|
|
78
|
-
###
|
|
41
|
+
### Basic Usage
|
|
42
|
+
|
|
43
|
+
#### VideoPlayer (Bare Component)
|
|
44
|
+
For direct stream URL playback:
|
|
79
45
|
|
|
80
|
-
```
|
|
81
|
-
import {
|
|
46
|
+
```jsx
|
|
47
|
+
import { VideoPlayer } from '@motto-ui-components/motto-video-player';
|
|
82
48
|
|
|
83
|
-
function
|
|
49
|
+
function MyPlayer() {
|
|
84
50
|
return (
|
|
85
|
-
<
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
height={450}
|
|
93
|
-
/>
|
|
94
|
-
</div>
|
|
51
|
+
<VideoPlayer
|
|
52
|
+
src="https://example.com/video.m3u8"
|
|
53
|
+
controls
|
|
54
|
+
aspectRatio={16/9}
|
|
55
|
+
onPlay={() => console.log('Playing')}
|
|
56
|
+
onError={(error) => console.error(error)}
|
|
57
|
+
/>
|
|
95
58
|
);
|
|
96
59
|
}
|
|
97
60
|
```
|
|
98
61
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
```tsx
|
|
102
|
-
import { Player } from '@motto/video-player';
|
|
103
|
-
import { useEffect, useState } from 'react';
|
|
62
|
+
#### Video (Wrapper Component)
|
|
63
|
+
For data fetching with TanStack Query:
|
|
104
64
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
useEffect(() => {
|
|
109
|
-
setIsClient(true);
|
|
110
|
-
}, []);
|
|
111
|
-
|
|
112
|
-
if (!isClient) {
|
|
113
|
-
return <div>Loading player...</div>;
|
|
114
|
-
}
|
|
65
|
+
```jsx
|
|
66
|
+
import { Video } from '@motto-ui-components/motto-video-player';
|
|
115
67
|
|
|
68
|
+
function MyPlayer() {
|
|
116
69
|
return (
|
|
117
|
-
<
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
70
|
+
<Video
|
|
71
|
+
videoId="your-video-id"
|
|
72
|
+
publicKey="your-public-key"
|
|
73
|
+
controls
|
|
74
|
+
refetchInterval={30000}
|
|
75
|
+
events={{
|
|
76
|
+
onVideoData: (video) => console.log('Video loaded:', video),
|
|
77
|
+
onError: (error) => console.error('Error:', error),
|
|
78
|
+
onPlay: () => console.log('Playing')
|
|
79
|
+
}}
|
|
80
|
+
/>
|
|
127
81
|
);
|
|
128
82
|
}
|
|
129
83
|
```
|
|
130
84
|
|
|
131
|
-
##
|
|
132
|
-
|
|
133
|
-
The player accepts the following props:
|
|
85
|
+
## Component Comparison
|
|
134
86
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
- `loop` (boolean, default: false): Whether to loop the video
|
|
87
|
+
| Feature | VideoPlayer | Video |
|
|
88
|
+
|---------|-------------|-------|
|
|
89
|
+
| **Use Case** | Direct stream URL | Data fetching with videoId |
|
|
90
|
+
| **Data Fetching** | ❌ Manual | ✅ Automatic with TanStack Query |
|
|
91
|
+
| **Caching** | ❌ None | ✅ Smart caching & background updates |
|
|
92
|
+
| **Loading States** | ❌ Manual | ✅ Built-in loading indicators |
|
|
93
|
+
| **Error Handling** | ❌ Manual | ✅ Automatic retry with exponential backoff |
|
|
94
|
+
| **Performance** | ✅ Minimal overhead | ✅ Optimized with query deduplication |
|
|
144
95
|
|
|
145
96
|
## Advanced Configuration
|
|
146
97
|
|
|
147
|
-
###
|
|
148
|
-
|
|
149
|
-
```
|
|
150
|
-
<
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
98
|
+
### TanStack Query Options
|
|
99
|
+
|
|
100
|
+
```jsx
|
|
101
|
+
<Video
|
|
102
|
+
videoId="123"
|
|
103
|
+
publicKey="key"
|
|
104
|
+
refetchInterval={30000}
|
|
105
|
+
queryOptions={{
|
|
106
|
+
staleTime: 5 * 60 * 1000, // 5 minutes
|
|
107
|
+
retry: 3,
|
|
108
|
+
retryDelay: (attemptIndex) => Math.min(1000 * 2 ** attemptIndex, 30000)
|
|
156
109
|
}}
|
|
157
110
|
/>
|
|
158
111
|
```
|
|
159
112
|
|
|
160
|
-
###
|
|
113
|
+
### Skip Controls
|
|
161
114
|
|
|
162
|
-
```
|
|
163
|
-
<
|
|
164
|
-
src="
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
115
|
+
```jsx
|
|
116
|
+
<VideoPlayer
|
|
117
|
+
src="..."
|
|
118
|
+
skipConfig={{
|
|
119
|
+
showSkipBack: true,
|
|
120
|
+
showSkipForward: true,
|
|
121
|
+
skipDuration: 15,
|
|
122
|
+
position: 'controls' // or 'overlay'
|
|
170
123
|
}}
|
|
124
|
+
onSkipBack={(newTime) => console.log('Skipped to:', newTime)}
|
|
125
|
+
onSkipForward={(newTime) => console.log('Skipped to:', newTime)}
|
|
171
126
|
/>
|
|
172
127
|
```
|
|
173
128
|
|
|
174
|
-
###
|
|
129
|
+
### Responsive Sizing
|
|
130
|
+
|
|
131
|
+
```jsx
|
|
132
|
+
// Default responsive 16:9
|
|
133
|
+
<VideoPlayer src="..." />
|
|
175
134
|
|
|
176
|
-
|
|
177
|
-
<
|
|
178
|
-
|
|
135
|
+
// Custom aspect ratio
|
|
136
|
+
<VideoPlayer src="..." aspectRatio={4/3} />
|
|
137
|
+
|
|
138
|
+
// Fixed dimensions
|
|
139
|
+
<VideoPlayer src="..." width={800} height={450} />
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Analytics Integration
|
|
143
|
+
|
|
144
|
+
```jsx
|
|
145
|
+
<VideoPlayer
|
|
146
|
+
src="..."
|
|
179
147
|
muxConfig={{
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
148
|
+
debug: false,
|
|
149
|
+
data: {
|
|
150
|
+
env_key: 'your-mux-env-key',
|
|
151
|
+
video_title: 'Video Title',
|
|
152
|
+
video_id: 'video-123',
|
|
153
|
+
player_name: 'Web Player',
|
|
154
|
+
viewer_user_id: 'user-456'
|
|
184
155
|
}
|
|
185
156
|
}}
|
|
157
|
+
onMuxReady={(monitor) => console.log('Mux ready')}
|
|
186
158
|
/>
|
|
187
159
|
```
|
|
188
160
|
|
|
189
|
-
##
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
161
|
+
## API Reference
|
|
162
|
+
|
|
163
|
+
### VideoPlayer Props
|
|
164
|
+
|
|
165
|
+
```typescript
|
|
166
|
+
interface VideoPlayerProps {
|
|
167
|
+
src: string; // Video source URL
|
|
168
|
+
autoPlay?: boolean; // Auto-play video
|
|
169
|
+
controls?: boolean; // Show player controls
|
|
170
|
+
aspectRatio?: number; // Video aspect ratio (default: 16/9)
|
|
171
|
+
width?: number; // Fixed width
|
|
172
|
+
height?: number; // Fixed height
|
|
173
|
+
skipConfig?: SkipConfig; // Skip controls configuration
|
|
174
|
+
muxConfig?: MuxConfig; // Mux analytics configuration
|
|
175
|
+
onPlay?: () => void; // Play event callback
|
|
176
|
+
onPause?: () => void; // Pause event callback
|
|
177
|
+
onError?: (error: any) => void; // Error event callback
|
|
178
|
+
// ... more props
|
|
179
|
+
}
|
|
202
180
|
```
|
|
203
181
|
|
|
204
|
-
|
|
182
|
+
### Video Props
|
|
183
|
+
|
|
184
|
+
```typescript
|
|
185
|
+
interface VideoProps extends Omit<VideoPlayerProps, 'src'> {
|
|
186
|
+
videoId?: string; // Video ID for data fetching
|
|
187
|
+
publicKey?: string; // Public key for API authentication
|
|
188
|
+
videoData?: VideoData; // Pre-loaded video data
|
|
189
|
+
refetchInterval?: number; // Background refetch interval (ms)
|
|
190
|
+
queryOptions?: QueryOptions; // TanStack Query configuration
|
|
191
|
+
events?: {
|
|
192
|
+
onVideoData?: (video: VideoData) => void;
|
|
193
|
+
onEmptyPlaylists?: () => void;
|
|
194
|
+
onError?: (error: Error) => void;
|
|
195
|
+
// ... player events
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
```
|
|
205
199
|
|
|
206
|
-
|
|
200
|
+
## TanStack Query Benefits
|
|
207
201
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
/>
|
|
214
|
-
```
|
|
202
|
+
### Caching & Performance
|
|
203
|
+
- **Automatic Caching**: Videos are cached with configurable stale time
|
|
204
|
+
- **Background Refetching**: Data stays fresh with background updates
|
|
205
|
+
- **Request Deduplication**: Identical requests are automatically deduplicated
|
|
206
|
+
- **Garbage Collection**: Memory-efficient cleanup of unused cache entries
|
|
215
207
|
|
|
216
|
-
|
|
208
|
+
### Resilience & UX
|
|
209
|
+
- **Smart Retries**: Exponential backoff retry logic for failed requests
|
|
210
|
+
- **Loading States**: Built-in loading indicators for better UX
|
|
211
|
+
- **Error Recovery**: Automatic error handling and recovery mechanisms
|
|
212
|
+
- **Optimistic Updates**: Support for optimistic UI updates
|
|
217
213
|
|
|
218
|
-
|
|
214
|
+
## Examples
|
|
219
215
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
216
|
+
Check out the [example app](../../apps/example) for comprehensive usage examples including:
|
|
217
|
+
|
|
218
|
+
- Basic VideoPlayer usage
|
|
219
|
+
- Video wrapper with TanStack Query
|
|
220
|
+
- Pre-loaded data scenarios
|
|
221
|
+
- Skip controls integration
|
|
222
|
+
- Responsive design patterns
|
|
226
223
|
|
|
227
|
-
##
|
|
224
|
+
## Contributing
|
|
228
225
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
226
|
+
1. Clone the repository
|
|
227
|
+
2. Install dependencies: `pnpm install`
|
|
228
|
+
3. Start development: `pnpm dev`
|
|
229
|
+
4. Build: `pnpm build`
|
|
233
230
|
|
|
234
231
|
## License
|
|
235
232
|
|
|
236
|
-
|
|
233
|
+
ISC
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import React, { HTMLAttributes } from 'react';
|
|
2
|
+
import { QueryClient } from '@tanstack/react-query';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Unified events interface for both Player and Video wrapper
|
|
@@ -225,17 +225,7 @@ interface PlayerProps extends Omit<HTMLAttributes<HTMLVideoElement>, 'src' | 'on
|
|
|
225
225
|
* Event callbacks
|
|
226
226
|
*/
|
|
227
227
|
events?: PlayerEvents;
|
|
228
|
-
/**
|
|
229
|
-
* CSS class name for the container element
|
|
230
|
-
*/
|
|
231
228
|
containerClassName?: string;
|
|
232
|
-
/**
|
|
233
|
-
* Optional manual override for stream start time
|
|
234
|
-
* If not provided, the player will attempt to auto-detect the stream start time
|
|
235
|
-
* from the manifest for live streams. When provided, shows elapsed time since
|
|
236
|
-
* stream started instead of the current playback position.
|
|
237
|
-
*/
|
|
238
|
-
streamStartDate?: Date;
|
|
239
229
|
}
|
|
240
230
|
/**
|
|
241
231
|
* Mux Analytics type definitions
|
|
@@ -330,7 +320,7 @@ interface MuxAnalyticsConfig {
|
|
|
330
320
|
metadata?: MuxMetadata;
|
|
331
321
|
}
|
|
332
322
|
|
|
333
|
-
declare const Player:
|
|
323
|
+
declare const Player: React.ForwardRefExoticComponent<PlayerProps & React.RefAttributes<HTMLVideoElement>>;
|
|
334
324
|
|
|
335
325
|
interface VideoData {
|
|
336
326
|
id: string;
|
|
@@ -352,22 +342,6 @@ interface VideoListItem {
|
|
|
352
342
|
}>;
|
|
353
343
|
error?: string;
|
|
354
344
|
}
|
|
355
|
-
/**
|
|
356
|
-
* Fetches video data from the Motto Streaming API
|
|
357
|
-
* @param videoId - The ID of the video to fetch
|
|
358
|
-
* @param publicKey - The public key for authentication
|
|
359
|
-
* @param mottoToken - Optional motto token for authenticated requests
|
|
360
|
-
* @returns Promise<VideoData> - The video data
|
|
361
|
-
*/
|
|
362
|
-
declare const fetchVideoData: (videoId: string, publicKey: string, mottoToken?: string) => Promise<VideoData>;
|
|
363
|
-
/**
|
|
364
|
-
* Fetches multiple videos data from the Motto Streaming API
|
|
365
|
-
* @param publicKey - The public key for authentication
|
|
366
|
-
* @param videoIds - Array of video IDs to fetch
|
|
367
|
-
* @param mottoToken - Optional motto token for authenticated requests
|
|
368
|
-
* @returns Promise<VideoListItem[]> - Array of video data
|
|
369
|
-
*/
|
|
370
|
-
declare function fetchVideosList(publicKey: string, videoIds: string[], mottoToken?: string, skip?: number, limit?: number): Promise<VideoListItem[]>;
|
|
371
345
|
|
|
372
346
|
interface EventData {
|
|
373
347
|
id: string;
|
|
@@ -383,7 +357,6 @@ declare enum EventsSortDirection {
|
|
|
383
357
|
ASC = "asc",
|
|
384
358
|
DESC = "desc"
|
|
385
359
|
}
|
|
386
|
-
declare function fetchEventData(publicKey: string, eventId: string, unused?: any, filter?: string, order?: EventsSortDirection, locale?: string): Promise<EventData>;
|
|
387
360
|
|
|
388
361
|
interface CreativeWorkData {
|
|
389
362
|
id: string;
|
|
@@ -399,7 +372,6 @@ declare enum CreativeWorksSortDirection {
|
|
|
399
372
|
ASC = "asc",
|
|
400
373
|
DESC = "desc"
|
|
401
374
|
}
|
|
402
|
-
declare function fetchCreativeWorkData(publicKey: string, creativeWorkId: string, unused?: any, filter?: string, order?: CreativeWorksSortDirection, locale?: string): Promise<CreativeWorkData>;
|
|
403
375
|
|
|
404
376
|
interface VideoProps extends Omit<PlayerProps, 'src'> {
|
|
405
377
|
videoId?: string;
|
|
@@ -420,7 +392,7 @@ interface VideoProps extends Omit<PlayerProps, 'src'> {
|
|
|
420
392
|
onCanPlay?: () => void;
|
|
421
393
|
onPlayerReady?: () => void;
|
|
422
394
|
};
|
|
423
|
-
children?:
|
|
395
|
+
children?: React.ReactNode;
|
|
424
396
|
className?: string;
|
|
425
397
|
queryOptions?: {
|
|
426
398
|
enabled?: boolean;
|
|
@@ -430,7 +402,7 @@ interface VideoProps extends Omit<PlayerProps, 'src'> {
|
|
|
430
402
|
retryDelay?: number;
|
|
431
403
|
};
|
|
432
404
|
}
|
|
433
|
-
declare const Video:
|
|
405
|
+
declare const Video: React.FC<VideoProps>;
|
|
434
406
|
|
|
435
407
|
interface EventProps extends Omit<PlayerProps, 'src'> {
|
|
436
408
|
publicKey: string;
|
|
@@ -468,7 +440,7 @@ interface EventProps extends Omit<PlayerProps, 'src'> {
|
|
|
468
440
|
retryDelay?: number;
|
|
469
441
|
};
|
|
470
442
|
}
|
|
471
|
-
declare const Event:
|
|
443
|
+
declare const Event: React.FC<EventProps>;
|
|
472
444
|
|
|
473
445
|
interface CreativeWorkProps extends Omit<PlayerProps, 'src'> {
|
|
474
446
|
publicKey: string;
|
|
@@ -506,15 +478,12 @@ interface CreativeWorkProps extends Omit<PlayerProps, 'src'> {
|
|
|
506
478
|
retryDelay?: number;
|
|
507
479
|
};
|
|
508
480
|
}
|
|
509
|
-
declare const CreativeWork:
|
|
481
|
+
declare const CreativeWork: React.FC<CreativeWorkProps>;
|
|
510
482
|
|
|
483
|
+
declare const queryClient: QueryClient;
|
|
511
484
|
interface QueryProviderProps {
|
|
512
|
-
children:
|
|
485
|
+
children: React.ReactNode;
|
|
513
486
|
}
|
|
514
|
-
declare const QueryProvider:
|
|
515
|
-
|
|
516
|
-
declare const _default: {
|
|
517
|
-
Player: React.ForwardRefExoticComponent<PlayerProps & React.RefAttributes<HTMLVideoElement>>;
|
|
518
|
-
};
|
|
487
|
+
declare const QueryProvider: React.FC<QueryProviderProps>;
|
|
519
488
|
|
|
520
|
-
export { CreativeWork, type CreativeWorkData, type CreativeWorkProps, CreativeWorksSortDirection, Event, type EventData, type EventProps, EventsSortDirection,
|
|
489
|
+
export { CreativeWork, type CreativeWorkData, type CreativeWorkProps, CreativeWorksSortDirection, Event, type EventData, type EventProps, EventsSortDirection, Player, type PlayerEvents, type PlayerProps, QueryProvider, Video, type VideoData, type VideoListItem, type VideoProps, queryClient };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import React, { HTMLAttributes } from 'react';
|
|
2
|
+
import { QueryClient } from '@tanstack/react-query';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Unified events interface for both Player and Video wrapper
|
|
@@ -225,17 +225,7 @@ interface PlayerProps extends Omit<HTMLAttributes<HTMLVideoElement>, 'src' | 'on
|
|
|
225
225
|
* Event callbacks
|
|
226
226
|
*/
|
|
227
227
|
events?: PlayerEvents;
|
|
228
|
-
/**
|
|
229
|
-
* CSS class name for the container element
|
|
230
|
-
*/
|
|
231
228
|
containerClassName?: string;
|
|
232
|
-
/**
|
|
233
|
-
* Optional manual override for stream start time
|
|
234
|
-
* If not provided, the player will attempt to auto-detect the stream start time
|
|
235
|
-
* from the manifest for live streams. When provided, shows elapsed time since
|
|
236
|
-
* stream started instead of the current playback position.
|
|
237
|
-
*/
|
|
238
|
-
streamStartDate?: Date;
|
|
239
229
|
}
|
|
240
230
|
/**
|
|
241
231
|
* Mux Analytics type definitions
|
|
@@ -330,7 +320,7 @@ interface MuxAnalyticsConfig {
|
|
|
330
320
|
metadata?: MuxMetadata;
|
|
331
321
|
}
|
|
332
322
|
|
|
333
|
-
declare const Player:
|
|
323
|
+
declare const Player: React.ForwardRefExoticComponent<PlayerProps & React.RefAttributes<HTMLVideoElement>>;
|
|
334
324
|
|
|
335
325
|
interface VideoData {
|
|
336
326
|
id: string;
|
|
@@ -352,22 +342,6 @@ interface VideoListItem {
|
|
|
352
342
|
}>;
|
|
353
343
|
error?: string;
|
|
354
344
|
}
|
|
355
|
-
/**
|
|
356
|
-
* Fetches video data from the Motto Streaming API
|
|
357
|
-
* @param videoId - The ID of the video to fetch
|
|
358
|
-
* @param publicKey - The public key for authentication
|
|
359
|
-
* @param mottoToken - Optional motto token for authenticated requests
|
|
360
|
-
* @returns Promise<VideoData> - The video data
|
|
361
|
-
*/
|
|
362
|
-
declare const fetchVideoData: (videoId: string, publicKey: string, mottoToken?: string) => Promise<VideoData>;
|
|
363
|
-
/**
|
|
364
|
-
* Fetches multiple videos data from the Motto Streaming API
|
|
365
|
-
* @param publicKey - The public key for authentication
|
|
366
|
-
* @param videoIds - Array of video IDs to fetch
|
|
367
|
-
* @param mottoToken - Optional motto token for authenticated requests
|
|
368
|
-
* @returns Promise<VideoListItem[]> - Array of video data
|
|
369
|
-
*/
|
|
370
|
-
declare function fetchVideosList(publicKey: string, videoIds: string[], mottoToken?: string, skip?: number, limit?: number): Promise<VideoListItem[]>;
|
|
371
345
|
|
|
372
346
|
interface EventData {
|
|
373
347
|
id: string;
|
|
@@ -383,7 +357,6 @@ declare enum EventsSortDirection {
|
|
|
383
357
|
ASC = "asc",
|
|
384
358
|
DESC = "desc"
|
|
385
359
|
}
|
|
386
|
-
declare function fetchEventData(publicKey: string, eventId: string, unused?: any, filter?: string, order?: EventsSortDirection, locale?: string): Promise<EventData>;
|
|
387
360
|
|
|
388
361
|
interface CreativeWorkData {
|
|
389
362
|
id: string;
|
|
@@ -399,7 +372,6 @@ declare enum CreativeWorksSortDirection {
|
|
|
399
372
|
ASC = "asc",
|
|
400
373
|
DESC = "desc"
|
|
401
374
|
}
|
|
402
|
-
declare function fetchCreativeWorkData(publicKey: string, creativeWorkId: string, unused?: any, filter?: string, order?: CreativeWorksSortDirection, locale?: string): Promise<CreativeWorkData>;
|
|
403
375
|
|
|
404
376
|
interface VideoProps extends Omit<PlayerProps, 'src'> {
|
|
405
377
|
videoId?: string;
|
|
@@ -420,7 +392,7 @@ interface VideoProps extends Omit<PlayerProps, 'src'> {
|
|
|
420
392
|
onCanPlay?: () => void;
|
|
421
393
|
onPlayerReady?: () => void;
|
|
422
394
|
};
|
|
423
|
-
children?:
|
|
395
|
+
children?: React.ReactNode;
|
|
424
396
|
className?: string;
|
|
425
397
|
queryOptions?: {
|
|
426
398
|
enabled?: boolean;
|
|
@@ -430,7 +402,7 @@ interface VideoProps extends Omit<PlayerProps, 'src'> {
|
|
|
430
402
|
retryDelay?: number;
|
|
431
403
|
};
|
|
432
404
|
}
|
|
433
|
-
declare const Video:
|
|
405
|
+
declare const Video: React.FC<VideoProps>;
|
|
434
406
|
|
|
435
407
|
interface EventProps extends Omit<PlayerProps, 'src'> {
|
|
436
408
|
publicKey: string;
|
|
@@ -468,7 +440,7 @@ interface EventProps extends Omit<PlayerProps, 'src'> {
|
|
|
468
440
|
retryDelay?: number;
|
|
469
441
|
};
|
|
470
442
|
}
|
|
471
|
-
declare const Event:
|
|
443
|
+
declare const Event: React.FC<EventProps>;
|
|
472
444
|
|
|
473
445
|
interface CreativeWorkProps extends Omit<PlayerProps, 'src'> {
|
|
474
446
|
publicKey: string;
|
|
@@ -506,15 +478,12 @@ interface CreativeWorkProps extends Omit<PlayerProps, 'src'> {
|
|
|
506
478
|
retryDelay?: number;
|
|
507
479
|
};
|
|
508
480
|
}
|
|
509
|
-
declare const CreativeWork:
|
|
481
|
+
declare const CreativeWork: React.FC<CreativeWorkProps>;
|
|
510
482
|
|
|
483
|
+
declare const queryClient: QueryClient;
|
|
511
484
|
interface QueryProviderProps {
|
|
512
|
-
children:
|
|
485
|
+
children: React.ReactNode;
|
|
513
486
|
}
|
|
514
|
-
declare const QueryProvider:
|
|
515
|
-
|
|
516
|
-
declare const _default: {
|
|
517
|
-
Player: React.ForwardRefExoticComponent<PlayerProps & React.RefAttributes<HTMLVideoElement>>;
|
|
518
|
-
};
|
|
487
|
+
declare const QueryProvider: React.FC<QueryProviderProps>;
|
|
519
488
|
|
|
520
|
-
export { CreativeWork, type CreativeWorkData, type CreativeWorkProps, CreativeWorksSortDirection, Event, type EventData, type EventProps, EventsSortDirection,
|
|
489
|
+
export { CreativeWork, type CreativeWorkData, type CreativeWorkProps, CreativeWorksSortDirection, Event, type EventData, type EventProps, EventsSortDirection, Player, type PlayerEvents, type PlayerProps, QueryProvider, Video, type VideoData, type VideoListItem, type VideoProps, queryClient };
|