@mottosports/motto-video-player 1.0.1-rc.24 → 1.0.1-rc.26
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.d.mts +70 -79
- package/dist/index.d.ts +70 -79
- package/dist/index.js +61 -87
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +61 -87
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,72 @@
|
|
|
1
1
|
import React, { HTMLAttributes } from 'react';
|
|
2
2
|
import { QueryClient } from '@tanstack/react-query';
|
|
3
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
|
+
playlist_url: string;
|
|
16
|
+
license_url: string;
|
|
17
|
+
}
|
|
18
|
+
interface Fairplay {
|
|
19
|
+
certificate_url: string;
|
|
20
|
+
license_url: string;
|
|
21
|
+
playlist_url: string;
|
|
22
|
+
}
|
|
23
|
+
interface Playready {
|
|
24
|
+
playlist_url: string;
|
|
25
|
+
license_url: string;
|
|
26
|
+
}
|
|
27
|
+
interface DRM {
|
|
28
|
+
token?: string;
|
|
29
|
+
widevine?: Widevine;
|
|
30
|
+
fairplay?: Fairplay;
|
|
31
|
+
playready?: Playready;
|
|
32
|
+
}
|
|
33
|
+
interface Playlist {
|
|
34
|
+
url: string;
|
|
35
|
+
format: string;
|
|
36
|
+
dvr_settings?: DVRSettings;
|
|
37
|
+
drm: DRM;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
interface EventData {
|
|
41
|
+
id: string;
|
|
42
|
+
title: string;
|
|
43
|
+
description?: string;
|
|
44
|
+
startTime: string;
|
|
45
|
+
endTime?: string;
|
|
46
|
+
posterUrl?: string;
|
|
47
|
+
videoIds?: string[];
|
|
48
|
+
error?: string;
|
|
49
|
+
}
|
|
50
|
+
declare enum EventsSortDirection {
|
|
51
|
+
ASC = "asc",
|
|
52
|
+
DESC = "desc"
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
interface CreativeWorkData {
|
|
56
|
+
id: string;
|
|
57
|
+
title: string;
|
|
58
|
+
description?: string;
|
|
59
|
+
releaseTime: string;
|
|
60
|
+
endTime?: string;
|
|
61
|
+
posterUrl?: string;
|
|
62
|
+
videoIds?: string[];
|
|
63
|
+
error?: string;
|
|
64
|
+
}
|
|
65
|
+
declare enum CreativeWorksSortDirection {
|
|
66
|
+
ASC = "asc",
|
|
67
|
+
DESC = "desc"
|
|
68
|
+
}
|
|
69
|
+
|
|
4
70
|
/**
|
|
5
71
|
* Unified events interface for both Player and Video wrapper
|
|
6
72
|
*/
|
|
@@ -111,7 +177,7 @@ interface PlayerProps extends Omit<HTMLAttributes<HTMLVideoElement>, 'src' | 'on
|
|
|
111
177
|
/**
|
|
112
178
|
* The source URL of the video (DASH, HLS, or regular MP4) or playlist object with DRM info
|
|
113
179
|
*/
|
|
114
|
-
src:
|
|
180
|
+
src: Playlist;
|
|
115
181
|
/**
|
|
116
182
|
* Whether the video should autoplay
|
|
117
183
|
*/
|
|
@@ -339,81 +405,6 @@ interface MuxAnalyticsConfig {
|
|
|
339
405
|
|
|
340
406
|
declare const Player: React.ForwardRefExoticComponent<PlayerProps & React.RefAttributes<HTMLVideoElement>>;
|
|
341
407
|
|
|
342
|
-
interface VideoData {
|
|
343
|
-
id: string;
|
|
344
|
-
name?: string;
|
|
345
|
-
description?: string;
|
|
346
|
-
playlists?: Array<{
|
|
347
|
-
url: string;
|
|
348
|
-
format: string;
|
|
349
|
-
}>;
|
|
350
|
-
error?: string;
|
|
351
|
-
}
|
|
352
|
-
interface DRMSettings {
|
|
353
|
-
window_size_seconds: number;
|
|
354
|
-
}
|
|
355
|
-
interface Widevine {
|
|
356
|
-
playlist_url: string;
|
|
357
|
-
license_url: string;
|
|
358
|
-
}
|
|
359
|
-
interface Fairplay {
|
|
360
|
-
certificate_url: string;
|
|
361
|
-
license_url: string;
|
|
362
|
-
playlist_url: string;
|
|
363
|
-
}
|
|
364
|
-
interface Playready {
|
|
365
|
-
playlist_url: string;
|
|
366
|
-
license_url: string;
|
|
367
|
-
}
|
|
368
|
-
interface DRM {
|
|
369
|
-
token?: string;
|
|
370
|
-
widevine?: Widevine;
|
|
371
|
-
fairplay?: Fairplay;
|
|
372
|
-
playready?: Playready;
|
|
373
|
-
}
|
|
374
|
-
interface VideoListItem {
|
|
375
|
-
id: string;
|
|
376
|
-
name?: string;
|
|
377
|
-
description?: string;
|
|
378
|
-
playlists?: Array<{
|
|
379
|
-
url: string;
|
|
380
|
-
format: string;
|
|
381
|
-
dvr_settings: DRMSettings;
|
|
382
|
-
dvr: DRM;
|
|
383
|
-
}>;
|
|
384
|
-
error?: string;
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
interface EventData {
|
|
388
|
-
id: string;
|
|
389
|
-
title: string;
|
|
390
|
-
description?: string;
|
|
391
|
-
startTime: string;
|
|
392
|
-
endTime?: string;
|
|
393
|
-
posterUrl?: string;
|
|
394
|
-
videoIds?: string[];
|
|
395
|
-
error?: string;
|
|
396
|
-
}
|
|
397
|
-
declare enum EventsSortDirection {
|
|
398
|
-
ASC = "asc",
|
|
399
|
-
DESC = "desc"
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
interface CreativeWorkData {
|
|
403
|
-
id: string;
|
|
404
|
-
title: string;
|
|
405
|
-
description?: string;
|
|
406
|
-
releaseTime: string;
|
|
407
|
-
endTime?: string;
|
|
408
|
-
posterUrl?: string;
|
|
409
|
-
videoIds?: string[];
|
|
410
|
-
error?: string;
|
|
411
|
-
}
|
|
412
|
-
declare enum CreativeWorksSortDirection {
|
|
413
|
-
ASC = "asc",
|
|
414
|
-
DESC = "desc"
|
|
415
|
-
}
|
|
416
|
-
|
|
417
408
|
interface VideoProps extends Omit<PlayerProps, 'src'> {
|
|
418
409
|
videoId?: string;
|
|
419
410
|
publicKey?: string;
|
|
@@ -460,7 +451,7 @@ interface EventProps extends Omit<PlayerProps, 'src' | 'drmConfig'> {
|
|
|
460
451
|
order?: EventsSortDirection;
|
|
461
452
|
events?: {
|
|
462
453
|
onEventData?: (event: EventData) => void;
|
|
463
|
-
onVideoData?: (video:
|
|
454
|
+
onVideoData?: (video: VideoData) => void;
|
|
464
455
|
onEmptyPlaylists?: () => void;
|
|
465
456
|
onError?: (error: Error) => void;
|
|
466
457
|
onPlay?: () => void;
|
|
@@ -498,7 +489,7 @@ interface CreativeWorkProps extends Omit<PlayerProps, 'src'> {
|
|
|
498
489
|
order?: CreativeWorksSortDirection;
|
|
499
490
|
events?: {
|
|
500
491
|
onCreativeWorkData?: (creativeWork: CreativeWorkData) => void;
|
|
501
|
-
onVideoData?: (video:
|
|
492
|
+
onVideoData?: (video: VideoData) => void;
|
|
502
493
|
onEmptyPlaylists?: () => void;
|
|
503
494
|
onError?: (error: Error) => void;
|
|
504
495
|
onPlay?: () => void;
|
|
@@ -551,4 +542,4 @@ interface BigPlayIconProps {
|
|
|
551
542
|
}
|
|
552
543
|
declare const BigPlayIcon: React.FC<BigPlayIconProps>;
|
|
553
544
|
|
|
554
|
-
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
|
|
545
|
+
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,72 @@
|
|
|
1
1
|
import React, { HTMLAttributes } from 'react';
|
|
2
2
|
import { QueryClient } from '@tanstack/react-query';
|
|
3
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
|
+
playlist_url: string;
|
|
16
|
+
license_url: string;
|
|
17
|
+
}
|
|
18
|
+
interface Fairplay {
|
|
19
|
+
certificate_url: string;
|
|
20
|
+
license_url: string;
|
|
21
|
+
playlist_url: string;
|
|
22
|
+
}
|
|
23
|
+
interface Playready {
|
|
24
|
+
playlist_url: string;
|
|
25
|
+
license_url: string;
|
|
26
|
+
}
|
|
27
|
+
interface DRM {
|
|
28
|
+
token?: string;
|
|
29
|
+
widevine?: Widevine;
|
|
30
|
+
fairplay?: Fairplay;
|
|
31
|
+
playready?: Playready;
|
|
32
|
+
}
|
|
33
|
+
interface Playlist {
|
|
34
|
+
url: string;
|
|
35
|
+
format: string;
|
|
36
|
+
dvr_settings?: DVRSettings;
|
|
37
|
+
drm: DRM;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
interface EventData {
|
|
41
|
+
id: string;
|
|
42
|
+
title: string;
|
|
43
|
+
description?: string;
|
|
44
|
+
startTime: string;
|
|
45
|
+
endTime?: string;
|
|
46
|
+
posterUrl?: string;
|
|
47
|
+
videoIds?: string[];
|
|
48
|
+
error?: string;
|
|
49
|
+
}
|
|
50
|
+
declare enum EventsSortDirection {
|
|
51
|
+
ASC = "asc",
|
|
52
|
+
DESC = "desc"
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
interface CreativeWorkData {
|
|
56
|
+
id: string;
|
|
57
|
+
title: string;
|
|
58
|
+
description?: string;
|
|
59
|
+
releaseTime: string;
|
|
60
|
+
endTime?: string;
|
|
61
|
+
posterUrl?: string;
|
|
62
|
+
videoIds?: string[];
|
|
63
|
+
error?: string;
|
|
64
|
+
}
|
|
65
|
+
declare enum CreativeWorksSortDirection {
|
|
66
|
+
ASC = "asc",
|
|
67
|
+
DESC = "desc"
|
|
68
|
+
}
|
|
69
|
+
|
|
4
70
|
/**
|
|
5
71
|
* Unified events interface for both Player and Video wrapper
|
|
6
72
|
*/
|
|
@@ -111,7 +177,7 @@ interface PlayerProps extends Omit<HTMLAttributes<HTMLVideoElement>, 'src' | 'on
|
|
|
111
177
|
/**
|
|
112
178
|
* The source URL of the video (DASH, HLS, or regular MP4) or playlist object with DRM info
|
|
113
179
|
*/
|
|
114
|
-
src:
|
|
180
|
+
src: Playlist;
|
|
115
181
|
/**
|
|
116
182
|
* Whether the video should autoplay
|
|
117
183
|
*/
|
|
@@ -339,81 +405,6 @@ interface MuxAnalyticsConfig {
|
|
|
339
405
|
|
|
340
406
|
declare const Player: React.ForwardRefExoticComponent<PlayerProps & React.RefAttributes<HTMLVideoElement>>;
|
|
341
407
|
|
|
342
|
-
interface VideoData {
|
|
343
|
-
id: string;
|
|
344
|
-
name?: string;
|
|
345
|
-
description?: string;
|
|
346
|
-
playlists?: Array<{
|
|
347
|
-
url: string;
|
|
348
|
-
format: string;
|
|
349
|
-
}>;
|
|
350
|
-
error?: string;
|
|
351
|
-
}
|
|
352
|
-
interface DRMSettings {
|
|
353
|
-
window_size_seconds: number;
|
|
354
|
-
}
|
|
355
|
-
interface Widevine {
|
|
356
|
-
playlist_url: string;
|
|
357
|
-
license_url: string;
|
|
358
|
-
}
|
|
359
|
-
interface Fairplay {
|
|
360
|
-
certificate_url: string;
|
|
361
|
-
license_url: string;
|
|
362
|
-
playlist_url: string;
|
|
363
|
-
}
|
|
364
|
-
interface Playready {
|
|
365
|
-
playlist_url: string;
|
|
366
|
-
license_url: string;
|
|
367
|
-
}
|
|
368
|
-
interface DRM {
|
|
369
|
-
token?: string;
|
|
370
|
-
widevine?: Widevine;
|
|
371
|
-
fairplay?: Fairplay;
|
|
372
|
-
playready?: Playready;
|
|
373
|
-
}
|
|
374
|
-
interface VideoListItem {
|
|
375
|
-
id: string;
|
|
376
|
-
name?: string;
|
|
377
|
-
description?: string;
|
|
378
|
-
playlists?: Array<{
|
|
379
|
-
url: string;
|
|
380
|
-
format: string;
|
|
381
|
-
dvr_settings: DRMSettings;
|
|
382
|
-
dvr: DRM;
|
|
383
|
-
}>;
|
|
384
|
-
error?: string;
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
interface EventData {
|
|
388
|
-
id: string;
|
|
389
|
-
title: string;
|
|
390
|
-
description?: string;
|
|
391
|
-
startTime: string;
|
|
392
|
-
endTime?: string;
|
|
393
|
-
posterUrl?: string;
|
|
394
|
-
videoIds?: string[];
|
|
395
|
-
error?: string;
|
|
396
|
-
}
|
|
397
|
-
declare enum EventsSortDirection {
|
|
398
|
-
ASC = "asc",
|
|
399
|
-
DESC = "desc"
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
interface CreativeWorkData {
|
|
403
|
-
id: string;
|
|
404
|
-
title: string;
|
|
405
|
-
description?: string;
|
|
406
|
-
releaseTime: string;
|
|
407
|
-
endTime?: string;
|
|
408
|
-
posterUrl?: string;
|
|
409
|
-
videoIds?: string[];
|
|
410
|
-
error?: string;
|
|
411
|
-
}
|
|
412
|
-
declare enum CreativeWorksSortDirection {
|
|
413
|
-
ASC = "asc",
|
|
414
|
-
DESC = "desc"
|
|
415
|
-
}
|
|
416
|
-
|
|
417
408
|
interface VideoProps extends Omit<PlayerProps, 'src'> {
|
|
418
409
|
videoId?: string;
|
|
419
410
|
publicKey?: string;
|
|
@@ -460,7 +451,7 @@ interface EventProps extends Omit<PlayerProps, 'src' | 'drmConfig'> {
|
|
|
460
451
|
order?: EventsSortDirection;
|
|
461
452
|
events?: {
|
|
462
453
|
onEventData?: (event: EventData) => void;
|
|
463
|
-
onVideoData?: (video:
|
|
454
|
+
onVideoData?: (video: VideoData) => void;
|
|
464
455
|
onEmptyPlaylists?: () => void;
|
|
465
456
|
onError?: (error: Error) => void;
|
|
466
457
|
onPlay?: () => void;
|
|
@@ -498,7 +489,7 @@ interface CreativeWorkProps extends Omit<PlayerProps, 'src'> {
|
|
|
498
489
|
order?: CreativeWorksSortDirection;
|
|
499
490
|
events?: {
|
|
500
491
|
onCreativeWorkData?: (creativeWork: CreativeWorkData) => void;
|
|
501
|
-
onVideoData?: (video:
|
|
492
|
+
onVideoData?: (video: VideoData) => void;
|
|
502
493
|
onEmptyPlaylists?: () => void;
|
|
503
494
|
onError?: (error: Error) => void;
|
|
504
495
|
onPlay?: () => void;
|
|
@@ -551,4 +542,4 @@ interface BigPlayIconProps {
|
|
|
551
542
|
}
|
|
552
543
|
declare const BigPlayIcon: React.FC<BigPlayIconProps>;
|
|
553
544
|
|
|
554
|
-
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
|
|
545
|
+
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 };
|
package/dist/index.js
CHANGED
|
@@ -1150,6 +1150,32 @@ var import_shaka_player4 = __toESM(require("shaka-player/dist/shaka-player.ui"))
|
|
|
1150
1150
|
// src/hooks/useShakePlayer.ts
|
|
1151
1151
|
var import_react = require("react");
|
|
1152
1152
|
var import_shaka_player = __toESM(require("shaka-player/dist/shaka-player.ui"));
|
|
1153
|
+
|
|
1154
|
+
// src/utils/devices.ts
|
|
1155
|
+
var isAppleDevice = () => {
|
|
1156
|
+
if (typeof navigator === "undefined") return false;
|
|
1157
|
+
const ua = navigator.userAgent || "";
|
|
1158
|
+
const isIOS = /iPad|iPhone|iPod/.test(ua) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
|
|
1159
|
+
const isSafari = /Safari/.test(ua) && !/Chrome|CriOS|FxiOS|Edg/.test(ua);
|
|
1160
|
+
const isMacSafari = /Macintosh/.test(ua) && isSafari;
|
|
1161
|
+
return isIOS || isMacSafari;
|
|
1162
|
+
};
|
|
1163
|
+
var isPlayReadySupported = () => {
|
|
1164
|
+
if (typeof navigator === "undefined" || typeof window === "undefined") {
|
|
1165
|
+
return false;
|
|
1166
|
+
}
|
|
1167
|
+
if (!navigator.requestMediaKeySystemAccess) {
|
|
1168
|
+
return false;
|
|
1169
|
+
}
|
|
1170
|
+
const userAgent = navigator.userAgent || "";
|
|
1171
|
+
const isWindows = /Windows/.test(userAgent);
|
|
1172
|
+
const isXbox = /Xbox/.test(userAgent);
|
|
1173
|
+
const isEdge = /Edg/.test(userAgent);
|
|
1174
|
+
const isIE = /Trident|MSIE/.test(userAgent);
|
|
1175
|
+
return isWindows || isXbox || isEdge || isIE;
|
|
1176
|
+
};
|
|
1177
|
+
|
|
1178
|
+
// src/hooks/useShakePlayer.ts
|
|
1153
1179
|
var useShakePlayer = ({
|
|
1154
1180
|
src,
|
|
1155
1181
|
shakaConfig,
|
|
@@ -1170,47 +1196,42 @@ var useShakePlayer = ({
|
|
|
1170
1196
|
if (shakaConfig) {
|
|
1171
1197
|
player.configure(shakaConfig);
|
|
1172
1198
|
}
|
|
1173
|
-
|
|
1174
|
-
const
|
|
1175
|
-
|
|
1176
|
-
if (
|
|
1177
|
-
const
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
const
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
servers: {},
|
|
1188
|
-
advanced: {}
|
|
1189
|
-
};
|
|
1190
|
-
if (useFairPlay && drmData.fairplay?.license_url) {
|
|
1191
|
-
drmConfig2.servers["com.apple.fps"] = drmData.fairplay.license_url;
|
|
1192
|
-
} else if (drmData.widevine?.license_url) {
|
|
1193
|
-
drmConfig2.servers["com.widevine.alpha"] = drmData.widevine.license_url;
|
|
1199
|
+
let manifestUrl = src.url;
|
|
1200
|
+
const isDRM = Boolean(src.drm);
|
|
1201
|
+
let cert = null;
|
|
1202
|
+
if (isDRM) {
|
|
1203
|
+
const isPlayReady = isPlayReadySupported();
|
|
1204
|
+
const isFairPlay = isAppleDevice();
|
|
1205
|
+
if (isAppleDevice() && src.drm.fairplay?.certificate_url) {
|
|
1206
|
+
const req = await fetch(src.drm.fairplay.certificate_url);
|
|
1207
|
+
cert = await req.arrayBuffer();
|
|
1208
|
+
manifestUrl = src.drm.fairplay.playlist_url;
|
|
1209
|
+
} else if (isPlayReady && src.drm.playready?.license_url) {
|
|
1210
|
+
manifestUrl = src.drm.playready.playlist_url;
|
|
1211
|
+
} else {
|
|
1212
|
+
manifestUrl = src.drm?.widevine?.playlist_url || "";
|
|
1194
1213
|
}
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
}
|
|
1202
|
-
|
|
1203
|
-
|
|
1214
|
+
player.configure({
|
|
1215
|
+
drm: {
|
|
1216
|
+
servers: {
|
|
1217
|
+
"com.widevine.alpha": src.drm.widevine?.license_url,
|
|
1218
|
+
"com.microsoft.playready": src.drm.playready?.license_url,
|
|
1219
|
+
"com.apple.fps": src.drm.fairplay?.license_url
|
|
1220
|
+
},
|
|
1221
|
+
...cert && {
|
|
1222
|
+
advanced: {
|
|
1223
|
+
"com.apple.fps": {
|
|
1224
|
+
serverCertificate: new Uint8Array(cert)
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1204
1228
|
}
|
|
1205
|
-
}
|
|
1206
|
-
if (Object.keys(drmConfig2.servers).length > 0) {
|
|
1207
|
-
player.configure({ drm: drmConfig2 });
|
|
1208
|
-
}
|
|
1229
|
+
});
|
|
1209
1230
|
const netEngine = player.getNetworkingEngine();
|
|
1210
1231
|
if (netEngine) {
|
|
1211
1232
|
netEngine.registerRequestFilter((type, request) => {
|
|
1212
1233
|
if (type === import_shaka_player.default.net.NetworkingEngine.RequestType.LICENSE) {
|
|
1213
|
-
request.headers["x-dt-custom-data"] =
|
|
1234
|
+
request.headers["x-dt-custom-data"] = src.drm.token;
|
|
1214
1235
|
}
|
|
1215
1236
|
});
|
|
1216
1237
|
netEngine.registerResponseFilter((type, response) => {
|
|
@@ -1224,15 +1245,7 @@ var useShakePlayer = ({
|
|
|
1224
1245
|
});
|
|
1225
1246
|
}
|
|
1226
1247
|
}
|
|
1227
|
-
|
|
1228
|
-
if (drmConfig.clearKeys) {
|
|
1229
|
-
player.configure({ "drm.clearKeys": drmConfig.clearKeys });
|
|
1230
|
-
}
|
|
1231
|
-
if (drmConfig.servers) {
|
|
1232
|
-
player.configure({ "drm.servers": drmConfig.servers });
|
|
1233
|
-
}
|
|
1234
|
-
}
|
|
1235
|
-
player.addEventListener("error", (event) => {
|
|
1248
|
+
player?.addEventListener("error", (event) => {
|
|
1236
1249
|
const error = event.detail;
|
|
1237
1250
|
if (error?.code === 7e3) {
|
|
1238
1251
|
return;
|
|
@@ -1390,7 +1403,7 @@ var import_mux_data_shakaplayer = __toESM(require("@mux/mux-data-shakaplayer"));
|
|
|
1390
1403
|
var import_shaka_player2 = __toESM(require("shaka-player/dist/shaka-player.ui"));
|
|
1391
1404
|
|
|
1392
1405
|
// package.json
|
|
1393
|
-
var version = "1.0.1-rc.
|
|
1406
|
+
var version = "1.0.1-rc.26";
|
|
1394
1407
|
|
|
1395
1408
|
// src/hooks/useMuxAnalytics.ts
|
|
1396
1409
|
var useMuxAnalytics = (playerRef, muxConfig, onMuxReady, onMuxDataUpdate) => {
|
|
@@ -4065,7 +4078,7 @@ var Video = ({
|
|
|
4065
4078
|
Player,
|
|
4066
4079
|
{
|
|
4067
4080
|
...props,
|
|
4068
|
-
src:
|
|
4081
|
+
src: activePlaylist,
|
|
4069
4082
|
className: (0, import_tailwind_merge3.twMerge)("video-player-container", className),
|
|
4070
4083
|
events,
|
|
4071
4084
|
containerClassName: "w-full h-full",
|
|
@@ -4079,14 +4092,6 @@ var import_react15 = require("react");
|
|
|
4079
4092
|
var import_tailwind_merge4 = require("tailwind-merge");
|
|
4080
4093
|
var import_react_query2 = require("@tanstack/react-query");
|
|
4081
4094
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
4082
|
-
var isAppleDevice = () => {
|
|
4083
|
-
if (typeof navigator === "undefined") return false;
|
|
4084
|
-
const ua = navigator.userAgent || navigator.vendor || "";
|
|
4085
|
-
const isIOS = /iPad|iPhone|iPod/.test(ua) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
|
|
4086
|
-
const isSafari = /Safari/.test(ua) && !/Chrome|CriOS|FxiOS|Edg/.test(ua);
|
|
4087
|
-
const isMacSafari = /Macintosh/.test(ua) && isSafari;
|
|
4088
|
-
return isIOS || isMacSafari;
|
|
4089
|
-
};
|
|
4090
4095
|
var Event = ({
|
|
4091
4096
|
publicKey,
|
|
4092
4097
|
eventId,
|
|
@@ -4119,7 +4124,6 @@ var Event = ({
|
|
|
4119
4124
|
const [activePlaylist, setActivePlaylist] = (0, import_react15.useState)();
|
|
4120
4125
|
const [activeVideoId, setActiveVideoId] = (0, import_react15.useState)();
|
|
4121
4126
|
const videoIds = eventData?.videoIds ?? [];
|
|
4122
|
-
const [isDRM, setIsDRM] = (0, import_react15.useState)(false);
|
|
4123
4127
|
const {
|
|
4124
4128
|
data: videosData,
|
|
4125
4129
|
isLoading: videosIsLoading,
|
|
@@ -4146,34 +4150,9 @@ var Event = ({
|
|
|
4146
4150
|
for (const video of videosWithPlaylists) {
|
|
4147
4151
|
const hlsPlaylist = findHLSPlaylist(video);
|
|
4148
4152
|
if (hlsPlaylist?.url) {
|
|
4149
|
-
|
|
4150
|
-
const drm = matchedPlaylist?.dvr;
|
|
4151
|
-
const hasDrm = Boolean(drm?.token);
|
|
4152
|
-
let selectedPlaylist;
|
|
4153
|
-
if (hasDrm) {
|
|
4154
|
-
const useFairPlay = isAppleDevice();
|
|
4155
|
-
if (useFairPlay && drm?.fairplay?.playlist_url && drm?.fairplay?.license_url) {
|
|
4156
|
-
selectedPlaylist = {
|
|
4157
|
-
url: drm.fairplay.playlist_url,
|
|
4158
|
-
format: matchedPlaylist?.format || "HLS",
|
|
4159
|
-
dvr: drm
|
|
4160
|
-
};
|
|
4161
|
-
} else if (drm?.widevine?.playlist_url && drm?.widevine?.license_url) {
|
|
4162
|
-
selectedPlaylist = {
|
|
4163
|
-
url: drm.widevine.playlist_url,
|
|
4164
|
-
format: matchedPlaylist?.format || "HLS",
|
|
4165
|
-
dvr: drm
|
|
4166
|
-
};
|
|
4167
|
-
} else {
|
|
4168
|
-
selectedPlaylist = matchedPlaylist;
|
|
4169
|
-
}
|
|
4170
|
-
} else {
|
|
4171
|
-
selectedPlaylist = hlsPlaylist.url;
|
|
4172
|
-
}
|
|
4173
|
-
setActivePlaylist(selectedPlaylist);
|
|
4153
|
+
setActivePlaylist(hlsPlaylist);
|
|
4174
4154
|
setActiveVideoId(video.id);
|
|
4175
4155
|
hlsPlaylistFound = true;
|
|
4176
|
-
setIsDRM(Boolean(hasDrm));
|
|
4177
4156
|
break;
|
|
4178
4157
|
}
|
|
4179
4158
|
}
|
|
@@ -4197,11 +4176,6 @@ var Event = ({
|
|
|
4197
4176
|
events.onEventData(eventData);
|
|
4198
4177
|
}
|
|
4199
4178
|
}, [eventData, events]);
|
|
4200
|
-
(0, import_react15.useEffect)(() => {
|
|
4201
|
-
if (isDRM) {
|
|
4202
|
-
console.log("DRM is enabled");
|
|
4203
|
-
}
|
|
4204
|
-
}, [isDRM]);
|
|
4205
4179
|
(0, import_react15.useEffect)(() => {
|
|
4206
4180
|
if (events?.onVideoData && activeVideoId && videosData) {
|
|
4207
4181
|
const activeVideo = videosData.find((video) => video.id === activeVideoId);
|
|
@@ -4518,7 +4492,7 @@ var CreativeWork = ({
|
|
|
4518
4492
|
for (const video of videosWithPlaylists) {
|
|
4519
4493
|
const hlsPlaylist = findHLSPlaylist(video);
|
|
4520
4494
|
if (hlsPlaylist?.url) {
|
|
4521
|
-
setActivePlaylist(hlsPlaylist
|
|
4495
|
+
setActivePlaylist(hlsPlaylist);
|
|
4522
4496
|
setActiveVideoId(video.id);
|
|
4523
4497
|
hlsPlaylistFound = true;
|
|
4524
4498
|
break;
|