@mottosports/motto-video-player 1.0.1-rc.5 → 1.0.1-rc.50
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 +167 -159
- package/dist/index.d.mts +137 -119
- package/dist/index.d.ts +137 -119
- package/dist/index.js +3276 -943
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3566 -1227
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,73 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import React, { HTMLAttributes } from 'react';
|
|
2
|
+
import { QueryClient } from '@tanstack/react-query';
|
|
3
|
+
|
|
4
|
+
interface VideoData {
|
|
5
|
+
id: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
playlists?: Playlist[];
|
|
9
|
+
error?: string;
|
|
10
|
+
}
|
|
11
|
+
interface DVRSettings {
|
|
12
|
+
window_size_seconds: number;
|
|
13
|
+
}
|
|
14
|
+
interface Widevine {
|
|
15
|
+
playlistUrl: string;
|
|
16
|
+
licenseUrl: string;
|
|
17
|
+
}
|
|
18
|
+
interface Fairplay {
|
|
19
|
+
certificateUrl: string;
|
|
20
|
+
licenseUrl: string;
|
|
21
|
+
playlistUrl: string;
|
|
22
|
+
}
|
|
23
|
+
interface Playready {
|
|
24
|
+
playlistUrl: string;
|
|
25
|
+
licenseUrl: string;
|
|
26
|
+
}
|
|
27
|
+
interface DRM {
|
|
28
|
+
token?: string;
|
|
29
|
+
licenseCacheKey?: string;
|
|
30
|
+
widevine?: Widevine;
|
|
31
|
+
fairplay?: Fairplay;
|
|
32
|
+
playready?: Playready;
|
|
33
|
+
}
|
|
34
|
+
interface Playlist {
|
|
35
|
+
id: string;
|
|
36
|
+
url: string;
|
|
37
|
+
format: string;
|
|
38
|
+
dvr_settings?: DVRSettings;
|
|
39
|
+
drm: DRM;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
interface EventData {
|
|
43
|
+
id: string;
|
|
44
|
+
title: string;
|
|
45
|
+
description?: string;
|
|
46
|
+
startTime: string;
|
|
47
|
+
endTime?: string;
|
|
48
|
+
posterUrl?: string;
|
|
49
|
+
videoIds?: string[];
|
|
50
|
+
error?: string;
|
|
51
|
+
}
|
|
52
|
+
declare enum EventsSortDirection {
|
|
53
|
+
ASC = "asc",
|
|
54
|
+
DESC = "desc"
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
interface CreativeWorkData {
|
|
58
|
+
id: string;
|
|
59
|
+
title: string;
|
|
60
|
+
description?: string;
|
|
61
|
+
releaseTime: string;
|
|
62
|
+
endTime?: string;
|
|
63
|
+
posterUrl?: string;
|
|
64
|
+
videoIds?: string[];
|
|
65
|
+
error?: string;
|
|
66
|
+
}
|
|
67
|
+
declare enum CreativeWorksSortDirection {
|
|
68
|
+
ASC = "asc",
|
|
69
|
+
DESC = "desc"
|
|
70
|
+
}
|
|
3
71
|
|
|
4
72
|
/**
|
|
5
73
|
* Unified events interface for both Player and Video wrapper
|
|
@@ -94,11 +162,24 @@ interface SeekbarConfig {
|
|
|
94
162
|
*/
|
|
95
163
|
played?: string;
|
|
96
164
|
}
|
|
165
|
+
/**
|
|
166
|
+
* Icon size configuration
|
|
167
|
+
*/
|
|
168
|
+
interface IconSizes {
|
|
169
|
+
/**
|
|
170
|
+
* Size for skip back/forward buttons (in pixels)
|
|
171
|
+
*/
|
|
172
|
+
skipButtons?: number;
|
|
173
|
+
/**
|
|
174
|
+
* Size for the big play button (in pixels)
|
|
175
|
+
*/
|
|
176
|
+
bigPlayButton?: number;
|
|
177
|
+
}
|
|
97
178
|
interface PlayerProps extends Omit<HTMLAttributes<HTMLVideoElement>, 'src' | 'onError'> {
|
|
98
179
|
/**
|
|
99
|
-
* The source URL of the video (DASH, HLS, or regular MP4)
|
|
180
|
+
* The source URL of the video (DASH, HLS, or regular MP4) or playlist object with DRM info
|
|
100
181
|
*/
|
|
101
|
-
src:
|
|
182
|
+
src: Playlist;
|
|
102
183
|
/**
|
|
103
184
|
* Whether the video should autoplay
|
|
104
185
|
*/
|
|
@@ -138,7 +219,7 @@ interface PlayerProps extends Omit<HTMLAttributes<HTMLVideoElement>, 'src' | 'on
|
|
|
138
219
|
*/
|
|
139
220
|
shakaConfig?: any;
|
|
140
221
|
/**
|
|
141
|
-
* DRM configuration for protected content
|
|
222
|
+
* DRM configuration for protected content (deprecated - now derived from src playlist)
|
|
142
223
|
*/
|
|
143
224
|
drmConfig?: {
|
|
144
225
|
clearKeys?: {
|
|
@@ -180,21 +261,15 @@ interface PlayerProps extends Omit<HTMLAttributes<HTMLVideoElement>, 'src' | 'on
|
|
|
180
261
|
nonLinearAdSlotHeight?: number;
|
|
181
262
|
};
|
|
182
263
|
/**
|
|
183
|
-
* Chromecast configuration
|
|
264
|
+
* Chromecast configuration (optional)
|
|
265
|
+
* Chromecast is always enabled by default. This config allows customization.
|
|
184
266
|
*/
|
|
185
267
|
chromecastConfig?: {
|
|
186
|
-
/**
|
|
187
|
-
* Whether to enable Chromecast support
|
|
188
|
-
*/
|
|
189
|
-
enabled?: boolean;
|
|
190
268
|
/**
|
|
191
269
|
* Custom receiver application ID
|
|
270
|
+
* Defaults to 'CC1AD845' (Google's default media receiver)
|
|
192
271
|
*/
|
|
193
272
|
receiverApplicationId?: string;
|
|
194
|
-
/**
|
|
195
|
-
* Whether to auto-join cast sessions
|
|
196
|
-
*/
|
|
197
|
-
autoJoinPolicy?: string;
|
|
198
273
|
};
|
|
199
274
|
/**
|
|
200
275
|
* Quality selection configuration
|
|
@@ -222,20 +297,14 @@ interface PlayerProps extends Omit<HTMLAttributes<HTMLVideoElement>, 'src' | 'on
|
|
|
222
297
|
*/
|
|
223
298
|
seekbarConfig?: SeekbarConfig;
|
|
224
299
|
/**
|
|
225
|
-
*
|
|
300
|
+
* Icon size configuration
|
|
226
301
|
*/
|
|
227
|
-
|
|
302
|
+
iconSizes?: IconSizes;
|
|
228
303
|
/**
|
|
229
|
-
*
|
|
304
|
+
* Event callbacks
|
|
230
305
|
*/
|
|
306
|
+
events?: PlayerEvents;
|
|
231
307
|
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
308
|
}
|
|
240
309
|
/**
|
|
241
310
|
* Mux Analytics type definitions
|
|
@@ -330,87 +399,20 @@ interface MuxAnalyticsConfig {
|
|
|
330
399
|
metadata?: MuxMetadata;
|
|
331
400
|
}
|
|
332
401
|
|
|
333
|
-
declare
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
interface VideoData {
|
|
342
|
-
id: string;
|
|
343
|
-
name?: string;
|
|
344
|
-
description?: string;
|
|
345
|
-
playlists?: Array<{
|
|
346
|
-
url: string;
|
|
347
|
-
format: string;
|
|
348
|
-
}>;
|
|
349
|
-
error?: string;
|
|
350
|
-
}
|
|
351
|
-
interface VideoListItem {
|
|
352
|
-
id: string;
|
|
353
|
-
name?: string;
|
|
354
|
-
description?: string;
|
|
355
|
-
playlists?: Array<{
|
|
356
|
-
url: string;
|
|
357
|
-
format: string;
|
|
358
|
-
}>;
|
|
359
|
-
error?: string;
|
|
360
|
-
}
|
|
361
|
-
/**
|
|
362
|
-
* Fetches video data from the Motto Streaming API
|
|
363
|
-
* @param videoId - The ID of the video to fetch
|
|
364
|
-
* @param publicKey - The public key for authentication
|
|
365
|
-
* @param mottoToken - Optional motto token for authenticated requests
|
|
366
|
-
* @returns Promise<VideoData> - The video data
|
|
367
|
-
*/
|
|
368
|
-
declare const fetchVideoData: (videoId: string, publicKey: string, mottoToken?: string) => Promise<VideoData>;
|
|
369
|
-
/**
|
|
370
|
-
* Fetches multiple videos data from the Motto Streaming API
|
|
371
|
-
* @param publicKey - The public key for authentication
|
|
372
|
-
* @param videoIds - Array of video IDs to fetch
|
|
373
|
-
* @param mottoToken - Optional motto token for authenticated requests
|
|
374
|
-
* @returns Promise<VideoListItem[]> - Array of video data
|
|
375
|
-
*/
|
|
376
|
-
declare function fetchVideosList(publicKey: string, videoIds: string[], mottoToken?: string, skip?: number, limit?: number): Promise<VideoListItem[]>;
|
|
377
|
-
|
|
378
|
-
interface EventData {
|
|
379
|
-
id: string;
|
|
380
|
-
title: string;
|
|
381
|
-
description?: string;
|
|
382
|
-
startTime: string;
|
|
383
|
-
endTime?: string;
|
|
384
|
-
posterUrl?: string;
|
|
385
|
-
videoIds?: string[];
|
|
386
|
-
error?: string;
|
|
387
|
-
}
|
|
388
|
-
declare enum EventsSortDirection {
|
|
389
|
-
ASC = "asc",
|
|
390
|
-
DESC = "desc"
|
|
402
|
+
declare global {
|
|
403
|
+
namespace google {
|
|
404
|
+
namespace ima {
|
|
405
|
+
class AdsRequest {
|
|
406
|
+
adTagUrl: string;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
391
410
|
}
|
|
392
|
-
declare
|
|
393
|
-
|
|
394
|
-
interface CreativeWorkData {
|
|
395
|
-
id: string;
|
|
396
|
-
title: string;
|
|
397
|
-
description?: string;
|
|
398
|
-
releaseTime: string;
|
|
399
|
-
endTime?: string;
|
|
400
|
-
posterUrl?: string;
|
|
401
|
-
videoIds?: string[];
|
|
402
|
-
error?: string;
|
|
403
|
-
}
|
|
404
|
-
declare enum CreativeWorksSortDirection {
|
|
405
|
-
ASC = "asc",
|
|
406
|
-
DESC = "desc"
|
|
407
|
-
}
|
|
408
|
-
declare function fetchCreativeWorkData(publicKey: string, creativeWorkId: string, unused?: any, filter?: string, order?: CreativeWorksSortDirection, locale?: string): Promise<CreativeWorkData>;
|
|
411
|
+
declare const Player: React.ForwardRefExoticComponent<PlayerProps & React.RefAttributes<HTMLVideoElement>>;
|
|
409
412
|
|
|
410
413
|
interface VideoProps extends Omit<PlayerProps, 'src'> {
|
|
411
414
|
videoId?: string;
|
|
412
415
|
publicKey?: string;
|
|
413
|
-
mottoToken?: string;
|
|
414
416
|
videoData?: VideoData;
|
|
415
417
|
refetchInterval?: number;
|
|
416
418
|
playerName?: string;
|
|
@@ -426,8 +428,15 @@ interface VideoProps extends Omit<PlayerProps, 'src'> {
|
|
|
426
428
|
onCanPlay?: () => void;
|
|
427
429
|
onPlayerReady?: () => void;
|
|
428
430
|
};
|
|
429
|
-
children?:
|
|
431
|
+
children?: React.ReactNode;
|
|
430
432
|
className?: string;
|
|
433
|
+
auth?: {
|
|
434
|
+
mottoToken?: string;
|
|
435
|
+
userId?: string;
|
|
436
|
+
};
|
|
437
|
+
settings?: {
|
|
438
|
+
backgroundImageUrl?: string;
|
|
439
|
+
};
|
|
431
440
|
queryOptions?: {
|
|
432
441
|
enabled?: boolean;
|
|
433
442
|
staleTime?: number;
|
|
@@ -436,9 +445,9 @@ interface VideoProps extends Omit<PlayerProps, 'src'> {
|
|
|
436
445
|
retryDelay?: number;
|
|
437
446
|
};
|
|
438
447
|
}
|
|
439
|
-
declare const Video:
|
|
448
|
+
declare const Video: React.FC<VideoProps>;
|
|
440
449
|
|
|
441
|
-
interface EventProps extends Omit<PlayerProps, 'src'> {
|
|
450
|
+
interface EventProps extends Omit<PlayerProps, 'src' | 'drmConfig'> {
|
|
442
451
|
publicKey: string;
|
|
443
452
|
eventId: string;
|
|
444
453
|
hideTitle?: boolean;
|
|
@@ -447,7 +456,7 @@ interface EventProps extends Omit<PlayerProps, 'src'> {
|
|
|
447
456
|
order?: EventsSortDirection;
|
|
448
457
|
events?: {
|
|
449
458
|
onEventData?: (event: EventData) => void;
|
|
450
|
-
onVideoData?: (video:
|
|
459
|
+
onVideoData?: (video: VideoData) => void;
|
|
451
460
|
onEmptyPlaylists?: () => void;
|
|
452
461
|
onError?: (error: Error) => void;
|
|
453
462
|
onPlay?: () => void;
|
|
@@ -474,7 +483,7 @@ interface EventProps extends Omit<PlayerProps, 'src'> {
|
|
|
474
483
|
retryDelay?: number;
|
|
475
484
|
};
|
|
476
485
|
}
|
|
477
|
-
declare const Event:
|
|
486
|
+
declare const Event: React.FC<EventProps>;
|
|
478
487
|
|
|
479
488
|
interface CreativeWorkProps extends Omit<PlayerProps, 'src'> {
|
|
480
489
|
publicKey: string;
|
|
@@ -485,7 +494,7 @@ interface CreativeWorkProps extends Omit<PlayerProps, 'src'> {
|
|
|
485
494
|
order?: CreativeWorksSortDirection;
|
|
486
495
|
events?: {
|
|
487
496
|
onCreativeWorkData?: (creativeWork: CreativeWorkData) => void;
|
|
488
|
-
onVideoData?: (video:
|
|
497
|
+
onVideoData?: (video: VideoData) => void;
|
|
489
498
|
onEmptyPlaylists?: () => void;
|
|
490
499
|
onError?: (error: Error) => void;
|
|
491
500
|
onPlay?: () => void;
|
|
@@ -512,21 +521,30 @@ interface CreativeWorkProps extends Omit<PlayerProps, 'src'> {
|
|
|
512
521
|
retryDelay?: number;
|
|
513
522
|
};
|
|
514
523
|
}
|
|
515
|
-
declare const CreativeWork:
|
|
516
|
-
|
|
517
|
-
/**
|
|
518
|
-
* Client-side wrapper for the Event component to prevent SSR issues
|
|
519
|
-
* This component ensures that Event is only rendered on the client-side
|
|
520
|
-
*/
|
|
521
|
-
declare const ClientSideEvent: React__default.FC<EventProps>;
|
|
524
|
+
declare const CreativeWork: React.FC<CreativeWorkProps>;
|
|
522
525
|
|
|
526
|
+
declare const queryClient: QueryClient;
|
|
523
527
|
interface QueryProviderProps {
|
|
524
|
-
children:
|
|
528
|
+
children: React.ReactNode;
|
|
525
529
|
}
|
|
526
|
-
declare const QueryProvider:
|
|
530
|
+
declare const QueryProvider: React.FC<QueryProviderProps>;
|
|
527
531
|
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
532
|
+
interface SkipBackIconProps {
|
|
533
|
+
size?: number;
|
|
534
|
+
className?: string;
|
|
535
|
+
}
|
|
536
|
+
declare const SkipBackIcon: React.FC<SkipBackIconProps>;
|
|
537
|
+
|
|
538
|
+
interface SkipForwardIconProps {
|
|
539
|
+
size?: number;
|
|
540
|
+
className?: string;
|
|
541
|
+
}
|
|
542
|
+
declare const SkipForwardIcon: React.FC<SkipForwardIconProps>;
|
|
543
|
+
|
|
544
|
+
interface BigPlayIconProps {
|
|
545
|
+
size?: number;
|
|
546
|
+
className?: string;
|
|
547
|
+
}
|
|
548
|
+
declare const BigPlayIcon: React.FC<BigPlayIconProps>;
|
|
531
549
|
|
|
532
|
-
export {
|
|
550
|
+
export { BigPlayIcon, CreativeWork, type CreativeWorkData, type CreativeWorkProps, CreativeWorksSortDirection, Event, type EventData, type EventProps, EventsSortDirection, type IconSizes, Player, type PlayerEvents, type PlayerProps, QueryProvider, SkipBackIcon, SkipForwardIcon, Video, type VideoData, type VideoProps, queryClient };
|