stormcloud-video-player 0.8.23 → 0.8.24

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.
@@ -334,6 +334,7 @@ var AIRY_ROKU_APP_ID = "com.freeairytv.roku";
334
334
  var AIRY_APP_NAME = "AiryTV Movies & TV";
335
335
  var AIRY_DEFAULT_CONTENT_URL = "https://live.airy.tv";
336
336
  var CTV_SESSION_STORAGE_KEY = "stormcloud.ctv.sid";
337
+ var PLAYER_ID_STORAGE_KEY = "stormcloud.player.id";
337
338
  var LG_TEST_APP_ID = "com.hulu.plus";
338
339
  var LG_TEST_APP_NAME = "Hulu";
339
340
  var LG_TEST_CONTENT_URL = "https://www.hulu.com/live-tv";
@@ -427,6 +428,30 @@ function isEquivalentDeviceIdType(tagType, runtimeType) {
427
428
  if (tag === runtime) return true;
428
429
  return ANDROID_ID_TYPES.has(tag) && ANDROID_ID_TYPES.has(runtime);
429
430
  }
431
+ function resolveNativeDeviceId() {
432
+ var bridgeSignals = readNativeBridgeSignals();
433
+ var platformDevice = readPlatformNativeDeviceId();
434
+ var deviceId = bridgeSignals.deviceId || readStoredDeviceId() || platformDevice.deviceId;
435
+ if (!deviceId || isMacroPlaceholder(deviceId) || isZeroedAdId(deviceId)) {
436
+ return void 0;
437
+ }
438
+ return deviceId;
439
+ }
440
+ function getOrCreateStoredUuid(storageKey) {
441
+ if (typeof window === "undefined") {
442
+ return void 0;
443
+ }
444
+ var existing = readStoredString(storageKey);
445
+ if (existing) {
446
+ return existing;
447
+ }
448
+ var id = createUuid();
449
+ try {
450
+ var _window_localStorage;
451
+ (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(storageKey, id);
452
+ } catch (unused) {}
453
+ return id;
454
+ }
430
455
  function getOrCreateCtvSessionId() {
431
456
  var existing = readStoredString(CTV_SESSION_STORAGE_KEY);
432
457
  if (existing) {
@@ -1387,19 +1412,12 @@ function getClientInfo() {
1387
1412
  visibilityState: document.visibilityState
1388
1413
  };
1389
1414
  }
1390
- function getBrowserID(clientInfo) {
1415
+ function sha256Hex(input) {
1391
1416
  return _async_to_generator(function() {
1392
- var _crypto_subtle, fingerprintString, encodedData, utf8, buffer, i, hashBuffer, hashHex, unused, hash, i1, char, fallbackHash, timestamp, random;
1417
+ var _crypto_subtle, encodedData, utf8, buffer, i, hashBuffer, unused, hash, i1, char, fallbackHash, timestamp, random;
1393
1418
  return _ts_generator(this, function(_state) {
1394
1419
  switch(_state.label){
1395
1420
  case 0:
1396
- if (cachedBrowserId) {
1397
- return [
1398
- 2,
1399
- cachedBrowserId
1400
- ];
1401
- }
1402
- fingerprintString = JSON.stringify(clientInfo);
1403
1421
  if (!(typeof crypto !== "undefined" && ((_crypto_subtle = crypto.subtle) === null || _crypto_subtle === void 0 ? void 0 : _crypto_subtle.digest))) return [
1404
1422
  3,
1405
1423
  5
@@ -1423,9 +1441,9 @@ function getBrowserID(clientInfo) {
1423
1441
  case 2:
1424
1442
  _state.sent();
1425
1443
  if (typeof TextEncoder !== "undefined") {
1426
- encodedData = new TextEncoder().encode(fingerprintString);
1444
+ encodedData = new TextEncoder().encode(input);
1427
1445
  } else {
1428
- utf8 = unescape(encodeURIComponent(fingerprintString));
1446
+ utf8 = unescape(encodeURIComponent(input));
1429
1447
  buffer = new Uint8Array(utf8.length);
1430
1448
  for(i = 0; i < utf8.length; i++){
1431
1449
  buffer[i] = utf8.charCodeAt(i);
@@ -1438,13 +1456,11 @@ function getBrowserID(clientInfo) {
1438
1456
  ];
1439
1457
  case 3:
1440
1458
  hashBuffer = _state.sent();
1441
- hashHex = Array.from(new Uint8Array(hashBuffer)).map(function(b) {
1442
- return b.toString(16).padStart(2, "0");
1443
- }).join("");
1444
- cachedBrowserId = hashHex;
1445
1459
  return [
1446
1460
  2,
1447
- hashHex
1461
+ Array.from(new Uint8Array(hashBuffer)).map(function(b) {
1462
+ return b.toString(16).padStart(2, "0");
1463
+ }).join("")
1448
1464
  ];
1449
1465
  case 4:
1450
1466
  unused = _state.sent();
@@ -1455,15 +1471,50 @@ function getBrowserID(clientInfo) {
1455
1471
  ];
1456
1472
  case 5:
1457
1473
  hash = 0;
1458
- for(i1 = 0; i1 < fingerprintString.length; i1++){
1459
- char = fingerprintString.charCodeAt(i1);
1474
+ for(i1 = 0; i1 < input.length; i1++){
1475
+ char = input.charCodeAt(i1);
1460
1476
  hash = (hash << 5) - hash + char;
1461
1477
  hash = hash & hash;
1462
1478
  }
1463
1479
  fallbackHash = Math.abs(hash).toString(16).padStart(8, "0");
1464
1480
  timestamp = Date.now().toString(16).padStart(12, "0");
1465
1481
  random = Math.random().toString(16).substring(2, 14).padStart(12, "0");
1466
- cachedBrowserId = (fallbackHash + timestamp + random).padEnd(64, "0");
1482
+ return [
1483
+ 2,
1484
+ (fallbackHash + timestamp + random).padEnd(64, "0")
1485
+ ];
1486
+ }
1487
+ });
1488
+ })();
1489
+ }
1490
+ function resolvePlayerIdentitySeed(clientInfo) {
1491
+ var nativeDeviceId = resolveNativeDeviceId();
1492
+ if (nativeDeviceId) {
1493
+ return "device:".concat(nativeDeviceId);
1494
+ }
1495
+ var persistedId = getOrCreateStoredUuid(PLAYER_ID_STORAGE_KEY);
1496
+ if (persistedId) {
1497
+ return "persisted:".concat(persistedId);
1498
+ }
1499
+ return "fingerprint:".concat(JSON.stringify(clientInfo));
1500
+ }
1501
+ function getBrowserID(clientInfo) {
1502
+ return _async_to_generator(function() {
1503
+ return _ts_generator(this, function(_state) {
1504
+ switch(_state.label){
1505
+ case 0:
1506
+ if (cachedBrowserId) {
1507
+ return [
1508
+ 2,
1509
+ cachedBrowserId
1510
+ ];
1511
+ }
1512
+ return [
1513
+ 4,
1514
+ sha256Hex(resolvePlayerIdentitySeed(clientInfo))
1515
+ ];
1516
+ case 1:
1517
+ cachedBrowserId = _state.sent();
1467
1518
  return [
1468
1519
  2,
1469
1520
  cachedBrowserId