@mottosports/motto-video-player 1.0.1-rc.37 → 1.0.1-rc.39
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.js +41 -29
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +41 -29
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1171,7 +1171,8 @@ var isPlayReadySupported = () => {
|
|
|
1171
1171
|
const isXbox = /Xbox/.test(userAgent);
|
|
1172
1172
|
const isEdge = /Edg/.test(userAgent);
|
|
1173
1173
|
const isIE = /Trident|MSIE/.test(userAgent);
|
|
1174
|
-
|
|
1174
|
+
const isWindows = /Windows/.test(userAgent);
|
|
1175
|
+
return isXbox || (isEdge || isIE) && isWindows;
|
|
1175
1176
|
};
|
|
1176
1177
|
var isChrome64PlusOnMacOrWindows = () => {
|
|
1177
1178
|
if (typeof navigator === "undefined") {
|
|
@@ -1198,7 +1199,7 @@ var isChrome64PlusOnMacOrWindows = () => {
|
|
|
1198
1199
|
var import_mux_data_shakaplayer = __toESM(require("@mux/mux-data-shakaplayer"));
|
|
1199
1200
|
|
|
1200
1201
|
// package.json
|
|
1201
|
-
var version = "1.0.1-rc.
|
|
1202
|
+
var version = "1.0.1-rc.39";
|
|
1202
1203
|
|
|
1203
1204
|
// src/utils/licenseCache.ts
|
|
1204
1205
|
var PERSISTENT_LICENSE_PREFIX = "motto_lic_";
|
|
@@ -1343,8 +1344,10 @@ var clearAllPersistentLicenses = () => {
|
|
|
1343
1344
|
localStorage.removeItem(key);
|
|
1344
1345
|
}
|
|
1345
1346
|
console.log(`Cleared ${keys.length} persistent license cache entries`);
|
|
1347
|
+
return keys.length;
|
|
1346
1348
|
} catch (error) {
|
|
1347
1349
|
console.error("Failed to clear persistent licenses:", error);
|
|
1350
|
+
return 0;
|
|
1348
1351
|
}
|
|
1349
1352
|
};
|
|
1350
1353
|
|
|
@@ -1417,17 +1420,26 @@ var useShakaPlayer = ({
|
|
|
1417
1420
|
"com.widevine.alpha": {
|
|
1418
1421
|
...drmConfig2.advanced?.["com.widevine.alpha"],
|
|
1419
1422
|
// set to `persistent-license` only on Chrome 64+ on MacOS/Windows: https://shaka-player-demo.appspot.com/docs/api/tutorial-faq.html
|
|
1420
|
-
sessionType: isChrome64PlusOnMacOrWindows() ? "persistent-license" : "temporary"
|
|
1423
|
+
sessionType: isChrome64PlusOnMacOrWindows() ? "persistent-license" : "temporary",
|
|
1424
|
+
"headers": {
|
|
1425
|
+
"x-dt-auth-token": src.drm.token || ""
|
|
1426
|
+
}
|
|
1421
1427
|
},
|
|
1422
1428
|
"com.microsoft.playready": {
|
|
1423
1429
|
...drmConfig2.advanced?.["com.microsoft.playready"],
|
|
1424
|
-
sessionType: "temporary"
|
|
1430
|
+
sessionType: "temporary",
|
|
1425
1431
|
// PlayReady always uses temporary sessions
|
|
1432
|
+
"headers": {
|
|
1433
|
+
"x-dt-auth-token": src.drm.token || ""
|
|
1434
|
+
}
|
|
1426
1435
|
},
|
|
1427
1436
|
"com.apple.fps": {
|
|
1428
1437
|
...drmConfig2.advanced?.["com.apple.fps"],
|
|
1429
|
-
sessionType: "temporary"
|
|
1438
|
+
sessionType: "temporary",
|
|
1430
1439
|
// FairPlay always uses temporary sessions - Safari won't play with persistent-license
|
|
1440
|
+
"headers": {
|
|
1441
|
+
"x-dt-auth-token": src.drm.token || ""
|
|
1442
|
+
}
|
|
1431
1443
|
}
|
|
1432
1444
|
};
|
|
1433
1445
|
if (storedSessionsMetadata.length > 0) {
|
|
@@ -1441,11 +1453,6 @@ var useShakaPlayer = ({
|
|
|
1441
1453
|
player.configure({ drm: drmConfig2 });
|
|
1442
1454
|
const netEngine = player.getNetworkingEngine();
|
|
1443
1455
|
if (netEngine) {
|
|
1444
|
-
netEngine.registerRequestFilter((type, request) => {
|
|
1445
|
-
if (type === import_shaka_player.default.net.NetworkingEngine.RequestType.LICENSE) {
|
|
1446
|
-
request.headers["x-dt-auth-token"] = src.drm.token;
|
|
1447
|
-
}
|
|
1448
|
-
});
|
|
1449
1456
|
netEngine.registerResponseFilter((type, response) => {
|
|
1450
1457
|
if (type === import_shaka_player.default.net.NetworkingEngine.RequestType.LICENSE) {
|
|
1451
1458
|
const ks = player.keySystem && player.keySystem();
|
|
@@ -1463,26 +1470,31 @@ var useShakaPlayer = ({
|
|
|
1463
1470
|
return;
|
|
1464
1471
|
}
|
|
1465
1472
|
if (error?.code >= 6e3 && error?.code < 7e3 && !isRetrying && videoElementRef.current) {
|
|
1466
|
-
console.warn(`DRM error detected (code: ${error.code}),
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1473
|
+
console.warn(`DRM error detected (code: ${error.code}), checking for cached licenses...`);
|
|
1474
|
+
const clearedCount = clearAllPersistentLicenses();
|
|
1475
|
+
if (clearedCount > 0) {
|
|
1476
|
+
console.warn(`Cleared ${clearedCount} cached licenses, retrying...`);
|
|
1477
|
+
setIsRetrying(true);
|
|
1478
|
+
setTimeout(async () => {
|
|
1479
|
+
try {
|
|
1480
|
+
const video2 = videoElementRef.current;
|
|
1481
|
+
const currentPlayer = playerRef.current;
|
|
1482
|
+
if (video2 && currentPlayer) {
|
|
1483
|
+
console.log("Reloading manifest after license cache clear...");
|
|
1484
|
+
await currentPlayer.load(getManifestUrl());
|
|
1485
|
+
console.log("Manifest reloaded successfully");
|
|
1486
|
+
}
|
|
1487
|
+
} catch (retryError) {
|
|
1488
|
+
console.error("Failed to retry after license clear:", retryError);
|
|
1489
|
+
onError?.(retryError);
|
|
1490
|
+
} finally {
|
|
1491
|
+
setIsRetrying(false);
|
|
1477
1492
|
}
|
|
1478
|
-
}
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
}
|
|
1482
|
-
|
|
1483
|
-
}
|
|
1484
|
-
}, 500);
|
|
1485
|
-
return;
|
|
1493
|
+
}, 500);
|
|
1494
|
+
return;
|
|
1495
|
+
} else {
|
|
1496
|
+
console.warn(`No cached licenses found to clear for error code ${error.code}, not retrying to avoid infinite loop`);
|
|
1497
|
+
}
|
|
1486
1498
|
}
|
|
1487
1499
|
console.error("Shaka Player Error:", error);
|
|
1488
1500
|
onError?.(new Error(`Shaka Player Error: ${error.message || "Unknown error"}`));
|