@mottosports/motto-video-player 1.0.1-rc.30 → 1.0.1-rc.32
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 +3 -9
- package/dist/index.d.ts +3 -9
- package/dist/index.js +27 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -17
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -259,21 +259,15 @@ interface PlayerProps extends Omit<HTMLAttributes<HTMLVideoElement>, 'src' | 'on
|
|
|
259
259
|
nonLinearAdSlotHeight?: number;
|
|
260
260
|
};
|
|
261
261
|
/**
|
|
262
|
-
* Chromecast configuration
|
|
262
|
+
* Chromecast configuration (optional)
|
|
263
|
+
* Chromecast is always enabled by default. This config allows customization.
|
|
263
264
|
*/
|
|
264
265
|
chromecastConfig?: {
|
|
265
|
-
/**
|
|
266
|
-
* Whether to enable Chromecast support
|
|
267
|
-
*/
|
|
268
|
-
enabled?: boolean;
|
|
269
266
|
/**
|
|
270
267
|
* Custom receiver application ID
|
|
268
|
+
* Defaults to 'CC1AD845' (Google's default media receiver)
|
|
271
269
|
*/
|
|
272
270
|
receiverApplicationId?: string;
|
|
273
|
-
/**
|
|
274
|
-
* Whether to auto-join cast sessions
|
|
275
|
-
*/
|
|
276
|
-
autoJoinPolicy?: string;
|
|
277
271
|
};
|
|
278
272
|
/**
|
|
279
273
|
* Quality selection configuration
|
package/dist/index.d.ts
CHANGED
|
@@ -259,21 +259,15 @@ interface PlayerProps extends Omit<HTMLAttributes<HTMLVideoElement>, 'src' | 'on
|
|
|
259
259
|
nonLinearAdSlotHeight?: number;
|
|
260
260
|
};
|
|
261
261
|
/**
|
|
262
|
-
* Chromecast configuration
|
|
262
|
+
* Chromecast configuration (optional)
|
|
263
|
+
* Chromecast is always enabled by default. This config allows customization.
|
|
263
264
|
*/
|
|
264
265
|
chromecastConfig?: {
|
|
265
|
-
/**
|
|
266
|
-
* Whether to enable Chromecast support
|
|
267
|
-
*/
|
|
268
|
-
enabled?: boolean;
|
|
269
266
|
/**
|
|
270
267
|
* Custom receiver application ID
|
|
268
|
+
* Defaults to 'CC1AD845' (Google's default media receiver)
|
|
271
269
|
*/
|
|
272
270
|
receiverApplicationId?: string;
|
|
273
|
-
/**
|
|
274
|
-
* Whether to auto-join cast sessions
|
|
275
|
-
*/
|
|
276
|
-
autoJoinPolicy?: string;
|
|
277
271
|
};
|
|
278
272
|
/**
|
|
279
273
|
* Quality selection configuration
|
package/dist/index.js
CHANGED
|
@@ -1168,18 +1168,17 @@ var isPlayReadySupported = () => {
|
|
|
1168
1168
|
return false;
|
|
1169
1169
|
}
|
|
1170
1170
|
const userAgent = navigator.userAgent || "";
|
|
1171
|
-
const isWindows = /Windows/.test(userAgent);
|
|
1172
1171
|
const isXbox = /Xbox/.test(userAgent);
|
|
1173
1172
|
const isEdge = /Edg/.test(userAgent);
|
|
1174
1173
|
const isIE = /Trident|MSIE/.test(userAgent);
|
|
1175
|
-
return
|
|
1174
|
+
return isXbox || isEdge || isIE;
|
|
1176
1175
|
};
|
|
1177
1176
|
|
|
1178
1177
|
// src/hooks/useShakePlayer.ts
|
|
1179
1178
|
var import_mux_data_shakaplayer = __toESM(require("@mux/mux-data-shakaplayer"));
|
|
1180
1179
|
|
|
1181
1180
|
// package.json
|
|
1182
|
-
var version = "1.0.1-rc.
|
|
1181
|
+
var version = "1.0.1-rc.32";
|
|
1183
1182
|
|
|
1184
1183
|
// src/hooks/useShakePlayer.ts
|
|
1185
1184
|
var useShakePlayer = ({
|
|
@@ -1210,7 +1209,6 @@ var useShakePlayer = ({
|
|
|
1210
1209
|
let cert = null;
|
|
1211
1210
|
if (isDRM) {
|
|
1212
1211
|
const isPlayReady = isPlayReadySupported();
|
|
1213
|
-
const isFairPlay = isAppleDevice();
|
|
1214
1212
|
if (isAppleDevice() && src.drm.fairplay?.certificate_url) {
|
|
1215
1213
|
const req = await fetch(src.drm.fairplay.certificate_url);
|
|
1216
1214
|
cert = await req.arrayBuffer();
|
|
@@ -1752,6 +1750,7 @@ var useShakaUI = (playerRef, containerRef, videoRef, controls, chromecastConfig,
|
|
|
1752
1750
|
"spacer",
|
|
1753
1751
|
"fullscreen",
|
|
1754
1752
|
"cast",
|
|
1753
|
+
// Always show cast button
|
|
1755
1754
|
"overflow_menu"
|
|
1756
1755
|
];
|
|
1757
1756
|
const uiConfig = {
|
|
@@ -1765,20 +1764,17 @@ var useShakaUI = (playerRef, containerRef, videoRef, controls, chromecastConfig,
|
|
|
1765
1764
|
},
|
|
1766
1765
|
controlPanelElements,
|
|
1767
1766
|
addBigPlayButton: isMobile,
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1767
|
+
// Always configure chromecast with defaults or provided config
|
|
1768
|
+
castReceiverAppId: chromecastConfig?.receiverApplicationId || "CC1AD845",
|
|
1769
|
+
// Default Media Receiver
|
|
1770
|
+
castAndroidReceiverCompatible: true,
|
|
1771
|
+
// Enable Android TV compatibility
|
|
1772
1772
|
overflowMenuButtons: [
|
|
1773
1773
|
"quality",
|
|
1774
1774
|
"picture_in_picture",
|
|
1775
1775
|
"playback_rate"
|
|
1776
1776
|
]
|
|
1777
1777
|
};
|
|
1778
|
-
if (chromecastConfig?.receiverApplicationId) {
|
|
1779
|
-
uiConfig.castReceiverAppId = chromecastConfig.receiverApplicationId;
|
|
1780
|
-
uiConfig.castAndroidReceiverCompatible = false;
|
|
1781
|
-
}
|
|
1782
1778
|
ui.configure(uiConfig);
|
|
1783
1779
|
if (isMobile) {
|
|
1784
1780
|
const customizeBigPlayButton = () => {
|
|
@@ -3433,15 +3429,29 @@ var Player = (0, import_react12.forwardRef)(
|
|
|
3433
3429
|
}
|
|
3434
3430
|
};
|
|
3435
3431
|
const initializeChromecast = () => {
|
|
3436
|
-
if (!chromecastConfig?.enabled) {
|
|
3437
|
-
return;
|
|
3438
|
-
}
|
|
3439
3432
|
try {
|
|
3440
|
-
if (
|
|
3441
|
-
|
|
3433
|
+
if (typeof window !== "undefined" && window.chrome?.cast) {
|
|
3434
|
+
const castContext = window.chrome.cast.CastContext.getInstance();
|
|
3435
|
+
if (castContext) {
|
|
3436
|
+
castContext.setOptions({
|
|
3437
|
+
receiverApplicationId: chromecastConfig?.receiverApplicationId || "CC1AD845"
|
|
3438
|
+
// Default Media Receiver
|
|
3439
|
+
});
|
|
3440
|
+
castContext.addEventListener("caststatechanged", (event) => {
|
|
3441
|
+
const isCasting = event.castState === "CONNECTED";
|
|
3442
|
+
events?.onCastStateChange?.(isCasting);
|
|
3443
|
+
});
|
|
3444
|
+
}
|
|
3445
|
+
} else {
|
|
3446
|
+
if (events?.onCastStateChange) {
|
|
3447
|
+
setTimeout(() => events.onCastStateChange(false), 100);
|
|
3448
|
+
}
|
|
3442
3449
|
}
|
|
3443
3450
|
} catch (error) {
|
|
3444
3451
|
console.warn("Chromecast initialization failed:", error);
|
|
3452
|
+
if (events?.onCastStateChange) {
|
|
3453
|
+
setTimeout(() => events.onCastStateChange(false), 100);
|
|
3454
|
+
}
|
|
3445
3455
|
}
|
|
3446
3456
|
};
|
|
3447
3457
|
(0, import_react12.useEffect)(() => {
|