@mottosports/motto-video-player 1.0.1-rc.7 → 1.0.1-rc.70
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 +178 -98
- package/dist/index.d.ts +178 -98
- package/dist/index.js +4154 -1327
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4118 -1287
- 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?: {
|
|
@@ -152,6 +233,10 @@ interface PlayerProps extends Omit<HTMLAttributes<HTMLVideoElement>, 'src' | 'on
|
|
|
152
233
|
* Mux Analytics configuration
|
|
153
234
|
*/
|
|
154
235
|
muxConfig?: MuxAnalyticsConfig;
|
|
236
|
+
/**
|
|
237
|
+
* System73 SDK configuration
|
|
238
|
+
*/
|
|
239
|
+
system73Config?: System73Config;
|
|
155
240
|
/**
|
|
156
241
|
* IMA (Interactive Media Ads) configuration
|
|
157
242
|
*/
|
|
@@ -180,21 +265,15 @@ interface PlayerProps extends Omit<HTMLAttributes<HTMLVideoElement>, 'src' | 'on
|
|
|
180
265
|
nonLinearAdSlotHeight?: number;
|
|
181
266
|
};
|
|
182
267
|
/**
|
|
183
|
-
* Chromecast configuration
|
|
268
|
+
* Chromecast configuration (optional)
|
|
269
|
+
* Chromecast is always enabled by default. This config allows customization.
|
|
184
270
|
*/
|
|
185
271
|
chromecastConfig?: {
|
|
186
|
-
/**
|
|
187
|
-
* Whether to enable Chromecast support
|
|
188
|
-
*/
|
|
189
|
-
enabled?: boolean;
|
|
190
272
|
/**
|
|
191
273
|
* Custom receiver application ID
|
|
274
|
+
* Defaults to 'CC1AD845' (Google's default media receiver)
|
|
192
275
|
*/
|
|
193
276
|
receiverApplicationId?: string;
|
|
194
|
-
/**
|
|
195
|
-
* Whether to auto-join cast sessions
|
|
196
|
-
*/
|
|
197
|
-
autoJoinPolicy?: string;
|
|
198
277
|
};
|
|
199
278
|
/**
|
|
200
279
|
* Quality selection configuration
|
|
@@ -221,21 +300,31 @@ interface PlayerProps extends Omit<HTMLAttributes<HTMLVideoElement>, 'src' | 'on
|
|
|
221
300
|
* Seekbar color configuration
|
|
222
301
|
*/
|
|
223
302
|
seekbarConfig?: SeekbarConfig;
|
|
303
|
+
/**
|
|
304
|
+
* Icon size configuration
|
|
305
|
+
*/
|
|
306
|
+
iconSizes?: IconSizes;
|
|
224
307
|
/**
|
|
225
308
|
* Event callbacks
|
|
226
309
|
*/
|
|
227
310
|
events?: PlayerEvents;
|
|
228
311
|
/**
|
|
229
|
-
*
|
|
312
|
+
* Locale for Shaka Player UI localization (e.g., 'en', 'ar', 'es')
|
|
313
|
+
* Defaults to 'en' if not provided
|
|
230
314
|
*/
|
|
315
|
+
locale?: string;
|
|
231
316
|
containerClassName?: string;
|
|
232
317
|
/**
|
|
233
|
-
*
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
318
|
+
* Motto public key used for authenticated requests
|
|
319
|
+
*/
|
|
320
|
+
publicKey?: string;
|
|
321
|
+
/**
|
|
322
|
+
* Authentication context for player operations
|
|
237
323
|
*/
|
|
238
|
-
|
|
324
|
+
auth?: {
|
|
325
|
+
mottoToken?: string;
|
|
326
|
+
userId?: string;
|
|
327
|
+
};
|
|
239
328
|
}
|
|
240
329
|
/**
|
|
241
330
|
* Mux Analytics type definitions
|
|
@@ -329,82 +418,51 @@ interface MuxAnalyticsConfig {
|
|
|
329
418
|
*/
|
|
330
419
|
metadata?: MuxMetadata;
|
|
331
420
|
}
|
|
332
|
-
|
|
333
|
-
declare const Player: React__default.ForwardRefExoticComponent<PlayerProps & React__default.RefAttributes<HTMLVideoElement>>;
|
|
334
|
-
|
|
335
|
-
interface VideoData {
|
|
336
|
-
id: string;
|
|
337
|
-
name?: string;
|
|
338
|
-
description?: string;
|
|
339
|
-
playlists?: Array<{
|
|
340
|
-
url: string;
|
|
341
|
-
format: string;
|
|
342
|
-
}>;
|
|
343
|
-
error?: string;
|
|
344
|
-
}
|
|
345
|
-
interface VideoListItem {
|
|
346
|
-
id: string;
|
|
347
|
-
name?: string;
|
|
348
|
-
description?: string;
|
|
349
|
-
playlists?: Array<{
|
|
350
|
-
url: string;
|
|
351
|
-
format: string;
|
|
352
|
-
}>;
|
|
353
|
-
error?: string;
|
|
354
|
-
}
|
|
355
421
|
/**
|
|
356
|
-
*
|
|
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
|
|
422
|
+
* System73 SDK configuration
|
|
361
423
|
*/
|
|
362
|
-
|
|
424
|
+
interface System73Config {
|
|
425
|
+
/**
|
|
426
|
+
* System73 API key (required for authentication)
|
|
427
|
+
*/
|
|
428
|
+
apiKey: string;
|
|
429
|
+
/**
|
|
430
|
+
* Content steering endpoint URI (optional)
|
|
431
|
+
*/
|
|
432
|
+
contentSteeringEndpoint?: string;
|
|
433
|
+
/**
|
|
434
|
+
* Channel identifier (optional)
|
|
435
|
+
*/
|
|
436
|
+
channelId?: string;
|
|
437
|
+
}
|
|
363
438
|
/**
|
|
364
|
-
*
|
|
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
|
|
439
|
+
* System73 SDK wrapper interface
|
|
369
440
|
*/
|
|
370
|
-
declare
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
videoIds?: string[];
|
|
380
|
-
error?: string;
|
|
381
|
-
}
|
|
382
|
-
declare enum EventsSortDirection {
|
|
383
|
-
ASC = "asc",
|
|
384
|
-
DESC = "desc"
|
|
441
|
+
declare global {
|
|
442
|
+
interface Window {
|
|
443
|
+
S73ShakaPlayerWrapper?: (config: System73Config, shakaInstance: {
|
|
444
|
+
shaka: any;
|
|
445
|
+
}) => {
|
|
446
|
+
wrapPlayerConfig: (config: any) => void;
|
|
447
|
+
wrapPlayer: (player: any) => void;
|
|
448
|
+
};
|
|
449
|
+
}
|
|
385
450
|
}
|
|
386
|
-
declare function fetchEventData(publicKey: string, eventId: string, unused?: any, filter?: string, order?: EventsSortDirection, locale?: string): Promise<EventData>;
|
|
387
451
|
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
error?: string;
|
|
397
|
-
}
|
|
398
|
-
declare enum CreativeWorksSortDirection {
|
|
399
|
-
ASC = "asc",
|
|
400
|
-
DESC = "desc"
|
|
452
|
+
declare global {
|
|
453
|
+
namespace google {
|
|
454
|
+
namespace ima {
|
|
455
|
+
class AdsRequest {
|
|
456
|
+
adTagUrl: string;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}
|
|
401
460
|
}
|
|
402
|
-
declare
|
|
461
|
+
declare const Player: React.ForwardRefExoticComponent<PlayerProps & React.RefAttributes<HTMLVideoElement>>;
|
|
403
462
|
|
|
404
463
|
interface VideoProps extends Omit<PlayerProps, 'src'> {
|
|
405
464
|
videoId?: string;
|
|
406
465
|
publicKey?: string;
|
|
407
|
-
mottoToken?: string;
|
|
408
466
|
videoData?: VideoData;
|
|
409
467
|
refetchInterval?: number;
|
|
410
468
|
playerName?: string;
|
|
@@ -420,8 +478,15 @@ interface VideoProps extends Omit<PlayerProps, 'src'> {
|
|
|
420
478
|
onCanPlay?: () => void;
|
|
421
479
|
onPlayerReady?: () => void;
|
|
422
480
|
};
|
|
423
|
-
children?:
|
|
481
|
+
children?: React.ReactNode;
|
|
424
482
|
className?: string;
|
|
483
|
+
auth?: {
|
|
484
|
+
mottoToken?: string;
|
|
485
|
+
userId?: string;
|
|
486
|
+
};
|
|
487
|
+
settings?: {
|
|
488
|
+
backgroundImageUrl?: string;
|
|
489
|
+
};
|
|
425
490
|
queryOptions?: {
|
|
426
491
|
enabled?: boolean;
|
|
427
492
|
staleTime?: number;
|
|
@@ -430,9 +495,9 @@ interface VideoProps extends Omit<PlayerProps, 'src'> {
|
|
|
430
495
|
retryDelay?: number;
|
|
431
496
|
};
|
|
432
497
|
}
|
|
433
|
-
declare const Video:
|
|
498
|
+
declare const Video: React.FC<VideoProps>;
|
|
434
499
|
|
|
435
|
-
interface EventProps extends Omit<PlayerProps, 'src'> {
|
|
500
|
+
interface EventProps extends Omit<PlayerProps, 'src' | 'drmConfig'> {
|
|
436
501
|
publicKey: string;
|
|
437
502
|
eventId: string;
|
|
438
503
|
hideTitle?: boolean;
|
|
@@ -441,7 +506,7 @@ interface EventProps extends Omit<PlayerProps, 'src'> {
|
|
|
441
506
|
order?: EventsSortDirection;
|
|
442
507
|
events?: {
|
|
443
508
|
onEventData?: (event: EventData) => void;
|
|
444
|
-
onVideoData?: (video:
|
|
509
|
+
onVideoData?: (video: VideoData) => void;
|
|
445
510
|
onEmptyPlaylists?: () => void;
|
|
446
511
|
onError?: (error: Error) => void;
|
|
447
512
|
onPlay?: () => void;
|
|
@@ -468,7 +533,7 @@ interface EventProps extends Omit<PlayerProps, 'src'> {
|
|
|
468
533
|
retryDelay?: number;
|
|
469
534
|
};
|
|
470
535
|
}
|
|
471
|
-
declare const Event:
|
|
536
|
+
declare const Event: React.FC<EventProps>;
|
|
472
537
|
|
|
473
538
|
interface CreativeWorkProps extends Omit<PlayerProps, 'src'> {
|
|
474
539
|
publicKey: string;
|
|
@@ -479,7 +544,7 @@ interface CreativeWorkProps extends Omit<PlayerProps, 'src'> {
|
|
|
479
544
|
order?: CreativeWorksSortDirection;
|
|
480
545
|
events?: {
|
|
481
546
|
onCreativeWorkData?: (creativeWork: CreativeWorkData) => void;
|
|
482
|
-
onVideoData?: (video:
|
|
547
|
+
onVideoData?: (video: VideoData) => void;
|
|
483
548
|
onEmptyPlaylists?: () => void;
|
|
484
549
|
onError?: (error: Error) => void;
|
|
485
550
|
onPlay?: () => void;
|
|
@@ -506,15 +571,30 @@ interface CreativeWorkProps extends Omit<PlayerProps, 'src'> {
|
|
|
506
571
|
retryDelay?: number;
|
|
507
572
|
};
|
|
508
573
|
}
|
|
509
|
-
declare const CreativeWork:
|
|
574
|
+
declare const CreativeWork: React.FC<CreativeWorkProps>;
|
|
510
575
|
|
|
576
|
+
declare const queryClient: QueryClient;
|
|
511
577
|
interface QueryProviderProps {
|
|
512
|
-
children:
|
|
578
|
+
children: React.ReactNode;
|
|
513
579
|
}
|
|
514
|
-
declare const QueryProvider:
|
|
580
|
+
declare const QueryProvider: React.FC<QueryProviderProps>;
|
|
515
581
|
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
582
|
+
interface SkipBackIconProps {
|
|
583
|
+
size?: number;
|
|
584
|
+
className?: string;
|
|
585
|
+
}
|
|
586
|
+
declare const SkipBackIcon: React.FC<SkipBackIconProps>;
|
|
587
|
+
|
|
588
|
+
interface SkipForwardIconProps {
|
|
589
|
+
size?: number;
|
|
590
|
+
className?: string;
|
|
591
|
+
}
|
|
592
|
+
declare const SkipForwardIcon: React.FC<SkipForwardIconProps>;
|
|
593
|
+
|
|
594
|
+
interface BigPlayIconProps {
|
|
595
|
+
size?: number;
|
|
596
|
+
className?: string;
|
|
597
|
+
}
|
|
598
|
+
declare const BigPlayIcon: React.FC<BigPlayIconProps>;
|
|
519
599
|
|
|
520
|
-
export { CreativeWork, type CreativeWorkData, type CreativeWorkProps, CreativeWorksSortDirection, Event, type EventData, type EventProps, EventsSortDirection, type
|
|
600
|
+
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 };
|