@mottosports/motto-video-player 1.0.1-rc.38 → 1.0.1-rc.40
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 +45 -29
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +45 -29
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1192,14 +1192,15 @@ var isChrome64PlusOnMacOrWindows = () => {
|
|
|
1192
1192
|
}
|
|
1193
1193
|
const isMacOS = /Mac OS X|Macintosh/.test(userAgent);
|
|
1194
1194
|
const isWindows = /Windows/.test(userAgent);
|
|
1195
|
-
|
|
1195
|
+
const isAndroid = /Android/.test(userAgent);
|
|
1196
|
+
return isMacOS || isWindows || isAndroid;
|
|
1196
1197
|
};
|
|
1197
1198
|
|
|
1198
1199
|
// src/hooks/useShakaPlayer.ts
|
|
1199
1200
|
var import_mux_data_shakaplayer = __toESM(require("@mux/mux-data-shakaplayer"));
|
|
1200
1201
|
|
|
1201
1202
|
// package.json
|
|
1202
|
-
var version = "1.0.1-rc.
|
|
1203
|
+
var version = "1.0.1-rc.40";
|
|
1203
1204
|
|
|
1204
1205
|
// src/utils/licenseCache.ts
|
|
1205
1206
|
var PERSISTENT_LICENSE_PREFIX = "motto_lic_";
|
|
@@ -1344,8 +1345,10 @@ var clearAllPersistentLicenses = () => {
|
|
|
1344
1345
|
localStorage.removeItem(key);
|
|
1345
1346
|
}
|
|
1346
1347
|
console.log(`Cleared ${keys.length} persistent license cache entries`);
|
|
1348
|
+
return keys.length;
|
|
1347
1349
|
} catch (error) {
|
|
1348
1350
|
console.error("Failed to clear persistent licenses:", error);
|
|
1351
|
+
return 0;
|
|
1349
1352
|
}
|
|
1350
1353
|
};
|
|
1351
1354
|
|
|
@@ -1405,6 +1408,10 @@ var useShakaPlayer = ({
|
|
|
1405
1408
|
"com.microsoft.playready": src.drm.playready?.licenseUrl,
|
|
1406
1409
|
"com.apple.fps": src.drm.fairplay?.licenseUrl
|
|
1407
1410
|
},
|
|
1411
|
+
keySystemsMapping: {
|
|
1412
|
+
// Fall back or reroute to the platform’s recommended PlayReady CDM if needed
|
|
1413
|
+
"com.microsoft.playready": "com.microsoft.playready.recommendation"
|
|
1414
|
+
},
|
|
1408
1415
|
...src.drm.fairplay && {
|
|
1409
1416
|
advanced: {
|
|
1410
1417
|
"com.apple.fps": {
|
|
@@ -1418,17 +1425,26 @@ var useShakaPlayer = ({
|
|
|
1418
1425
|
"com.widevine.alpha": {
|
|
1419
1426
|
...drmConfig2.advanced?.["com.widevine.alpha"],
|
|
1420
1427
|
// set to `persistent-license` only on Chrome 64+ on MacOS/Windows: https://shaka-player-demo.appspot.com/docs/api/tutorial-faq.html
|
|
1421
|
-
sessionType: isChrome64PlusOnMacOrWindows() ? "persistent-license" : "temporary"
|
|
1428
|
+
sessionType: isChrome64PlusOnMacOrWindows() ? "persistent-license" : "temporary",
|
|
1429
|
+
"headers": {
|
|
1430
|
+
"x-dt-auth-token": src.drm.token || ""
|
|
1431
|
+
}
|
|
1422
1432
|
},
|
|
1423
1433
|
"com.microsoft.playready": {
|
|
1424
1434
|
...drmConfig2.advanced?.["com.microsoft.playready"],
|
|
1425
|
-
sessionType: "temporary"
|
|
1435
|
+
sessionType: "temporary",
|
|
1426
1436
|
// PlayReady always uses temporary sessions
|
|
1437
|
+
"headers": {
|
|
1438
|
+
"x-dt-auth-token": src.drm.token || ""
|
|
1439
|
+
}
|
|
1427
1440
|
},
|
|
1428
1441
|
"com.apple.fps": {
|
|
1429
1442
|
...drmConfig2.advanced?.["com.apple.fps"],
|
|
1430
|
-
sessionType: "temporary"
|
|
1443
|
+
sessionType: "temporary",
|
|
1431
1444
|
// FairPlay always uses temporary sessions - Safari won't play with persistent-license
|
|
1445
|
+
"headers": {
|
|
1446
|
+
"x-dt-auth-token": src.drm.token || ""
|
|
1447
|
+
}
|
|
1432
1448
|
}
|
|
1433
1449
|
};
|
|
1434
1450
|
if (storedSessionsMetadata.length > 0) {
|
|
@@ -1442,11 +1458,6 @@ var useShakaPlayer = ({
|
|
|
1442
1458
|
player.configure({ drm: drmConfig2 });
|
|
1443
1459
|
const netEngine = player.getNetworkingEngine();
|
|
1444
1460
|
if (netEngine) {
|
|
1445
|
-
netEngine.registerRequestFilter((type, request) => {
|
|
1446
|
-
if (type === import_shaka_player.default.net.NetworkingEngine.RequestType.LICENSE) {
|
|
1447
|
-
request.headers["x-dt-auth-token"] = src.drm.token;
|
|
1448
|
-
}
|
|
1449
|
-
});
|
|
1450
1461
|
netEngine.registerResponseFilter((type, response) => {
|
|
1451
1462
|
if (type === import_shaka_player.default.net.NetworkingEngine.RequestType.LICENSE) {
|
|
1452
1463
|
const ks = player.keySystem && player.keySystem();
|
|
@@ -1464,26 +1475,31 @@ var useShakaPlayer = ({
|
|
|
1464
1475
|
return;
|
|
1465
1476
|
}
|
|
1466
1477
|
if (error?.code >= 6e3 && error?.code < 7e3 && !isRetrying && videoElementRef.current) {
|
|
1467
|
-
console.warn(`DRM error detected (code: ${error.code}),
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
+
console.warn(`DRM error detected (code: ${error.code}), checking for cached licenses...`);
|
|
1479
|
+
const clearedCount = clearAllPersistentLicenses();
|
|
1480
|
+
if (clearedCount > 0) {
|
|
1481
|
+
console.warn(`Cleared ${clearedCount} cached licenses, retrying...`);
|
|
1482
|
+
setIsRetrying(true);
|
|
1483
|
+
setTimeout(async () => {
|
|
1484
|
+
try {
|
|
1485
|
+
const video2 = videoElementRef.current;
|
|
1486
|
+
const currentPlayer = playerRef.current;
|
|
1487
|
+
if (video2 && currentPlayer) {
|
|
1488
|
+
console.log("Reloading manifest after license cache clear...");
|
|
1489
|
+
await currentPlayer.load(getManifestUrl());
|
|
1490
|
+
console.log("Manifest reloaded successfully");
|
|
1491
|
+
}
|
|
1492
|
+
} catch (retryError) {
|
|
1493
|
+
console.error("Failed to retry after license clear:", retryError);
|
|
1494
|
+
onError?.(retryError);
|
|
1495
|
+
} finally {
|
|
1496
|
+
setIsRetrying(false);
|
|
1478
1497
|
}
|
|
1479
|
-
}
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
}
|
|
1483
|
-
|
|
1484
|
-
}
|
|
1485
|
-
}, 500);
|
|
1486
|
-
return;
|
|
1498
|
+
}, 500);
|
|
1499
|
+
return;
|
|
1500
|
+
} else {
|
|
1501
|
+
console.warn(`No cached licenses found to clear for error code ${error.code}, not retrying to avoid infinite loop`);
|
|
1502
|
+
}
|
|
1487
1503
|
}
|
|
1488
1504
|
console.error("Shaka Player Error:", error);
|
|
1489
1505
|
onError?.(new Error(`Shaka Player Error: ${error.message || "Unknown error"}`));
|