@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.mjs
CHANGED
|
@@ -1130,7 +1130,8 @@ var isPlayReadySupported = () => {
|
|
|
1130
1130
|
const isXbox = /Xbox/.test(userAgent);
|
|
1131
1131
|
const isEdge = /Edg/.test(userAgent);
|
|
1132
1132
|
const isIE = /Trident|MSIE/.test(userAgent);
|
|
1133
|
-
|
|
1133
|
+
const isWindows = /Windows/.test(userAgent);
|
|
1134
|
+
return isXbox || (isEdge || isIE) && isWindows;
|
|
1134
1135
|
};
|
|
1135
1136
|
var isChrome64PlusOnMacOrWindows = () => {
|
|
1136
1137
|
if (typeof navigator === "undefined") {
|
|
@@ -1157,7 +1158,7 @@ var isChrome64PlusOnMacOrWindows = () => {
|
|
|
1157
1158
|
import initShakaPlayerMux from "@mux/mux-data-shakaplayer";
|
|
1158
1159
|
|
|
1159
1160
|
// package.json
|
|
1160
|
-
var version = "1.0.1-rc.
|
|
1161
|
+
var version = "1.0.1-rc.39";
|
|
1161
1162
|
|
|
1162
1163
|
// src/utils/licenseCache.ts
|
|
1163
1164
|
var PERSISTENT_LICENSE_PREFIX = "motto_lic_";
|
|
@@ -1302,8 +1303,10 @@ var clearAllPersistentLicenses = () => {
|
|
|
1302
1303
|
localStorage.removeItem(key);
|
|
1303
1304
|
}
|
|
1304
1305
|
console.log(`Cleared ${keys.length} persistent license cache entries`);
|
|
1306
|
+
return keys.length;
|
|
1305
1307
|
} catch (error) {
|
|
1306
1308
|
console.error("Failed to clear persistent licenses:", error);
|
|
1309
|
+
return 0;
|
|
1307
1310
|
}
|
|
1308
1311
|
};
|
|
1309
1312
|
|
|
@@ -1376,17 +1379,26 @@ var useShakaPlayer = ({
|
|
|
1376
1379
|
"com.widevine.alpha": {
|
|
1377
1380
|
...drmConfig2.advanced?.["com.widevine.alpha"],
|
|
1378
1381
|
// set to `persistent-license` only on Chrome 64+ on MacOS/Windows: https://shaka-player-demo.appspot.com/docs/api/tutorial-faq.html
|
|
1379
|
-
sessionType: isChrome64PlusOnMacOrWindows() ? "persistent-license" : "temporary"
|
|
1382
|
+
sessionType: isChrome64PlusOnMacOrWindows() ? "persistent-license" : "temporary",
|
|
1383
|
+
"headers": {
|
|
1384
|
+
"x-dt-auth-token": src.drm.token || ""
|
|
1385
|
+
}
|
|
1380
1386
|
},
|
|
1381
1387
|
"com.microsoft.playready": {
|
|
1382
1388
|
...drmConfig2.advanced?.["com.microsoft.playready"],
|
|
1383
|
-
sessionType: "temporary"
|
|
1389
|
+
sessionType: "temporary",
|
|
1384
1390
|
// PlayReady always uses temporary sessions
|
|
1391
|
+
"headers": {
|
|
1392
|
+
"x-dt-auth-token": src.drm.token || ""
|
|
1393
|
+
}
|
|
1385
1394
|
},
|
|
1386
1395
|
"com.apple.fps": {
|
|
1387
1396
|
...drmConfig2.advanced?.["com.apple.fps"],
|
|
1388
|
-
sessionType: "temporary"
|
|
1397
|
+
sessionType: "temporary",
|
|
1389
1398
|
// FairPlay always uses temporary sessions - Safari won't play with persistent-license
|
|
1399
|
+
"headers": {
|
|
1400
|
+
"x-dt-auth-token": src.drm.token || ""
|
|
1401
|
+
}
|
|
1390
1402
|
}
|
|
1391
1403
|
};
|
|
1392
1404
|
if (storedSessionsMetadata.length > 0) {
|
|
@@ -1400,11 +1412,6 @@ var useShakaPlayer = ({
|
|
|
1400
1412
|
player.configure({ drm: drmConfig2 });
|
|
1401
1413
|
const netEngine = player.getNetworkingEngine();
|
|
1402
1414
|
if (netEngine) {
|
|
1403
|
-
netEngine.registerRequestFilter((type, request) => {
|
|
1404
|
-
if (type === shaka.net.NetworkingEngine.RequestType.LICENSE) {
|
|
1405
|
-
request.headers["x-dt-auth-token"] = src.drm.token;
|
|
1406
|
-
}
|
|
1407
|
-
});
|
|
1408
1415
|
netEngine.registerResponseFilter((type, response) => {
|
|
1409
1416
|
if (type === shaka.net.NetworkingEngine.RequestType.LICENSE) {
|
|
1410
1417
|
const ks = player.keySystem && player.keySystem();
|
|
@@ -1422,26 +1429,31 @@ var useShakaPlayer = ({
|
|
|
1422
1429
|
return;
|
|
1423
1430
|
}
|
|
1424
1431
|
if (error?.code >= 6e3 && error?.code < 7e3 && !isRetrying && videoElementRef.current) {
|
|
1425
|
-
console.warn(`DRM error detected (code: ${error.code}),
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1432
|
+
console.warn(`DRM error detected (code: ${error.code}), checking for cached licenses...`);
|
|
1433
|
+
const clearedCount = clearAllPersistentLicenses();
|
|
1434
|
+
if (clearedCount > 0) {
|
|
1435
|
+
console.warn(`Cleared ${clearedCount} cached licenses, retrying...`);
|
|
1436
|
+
setIsRetrying(true);
|
|
1437
|
+
setTimeout(async () => {
|
|
1438
|
+
try {
|
|
1439
|
+
const video2 = videoElementRef.current;
|
|
1440
|
+
const currentPlayer = playerRef.current;
|
|
1441
|
+
if (video2 && currentPlayer) {
|
|
1442
|
+
console.log("Reloading manifest after license cache clear...");
|
|
1443
|
+
await currentPlayer.load(getManifestUrl());
|
|
1444
|
+
console.log("Manifest reloaded successfully");
|
|
1445
|
+
}
|
|
1446
|
+
} catch (retryError) {
|
|
1447
|
+
console.error("Failed to retry after license clear:", retryError);
|
|
1448
|
+
onError?.(retryError);
|
|
1449
|
+
} finally {
|
|
1450
|
+
setIsRetrying(false);
|
|
1436
1451
|
}
|
|
1437
|
-
}
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
}
|
|
1441
|
-
|
|
1442
|
-
}
|
|
1443
|
-
}, 500);
|
|
1444
|
-
return;
|
|
1452
|
+
}, 500);
|
|
1453
|
+
return;
|
|
1454
|
+
} else {
|
|
1455
|
+
console.warn(`No cached licenses found to clear for error code ${error.code}, not retrying to avoid infinite loop`);
|
|
1456
|
+
}
|
|
1445
1457
|
}
|
|
1446
1458
|
console.error("Shaka Player Error:", error);
|
|
1447
1459
|
onError?.(new Error(`Shaka Player Error: ${error.message || "Unknown error"}`));
|