stormcloud-video-player 0.8.21 → 0.8.23

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.
@@ -15,6 +15,7 @@ interface AdBreakOrchestratorHost {
15
15
  setAdPlayer(player: AdController): void;
16
16
  createAdPlayer(continueLiveStreamDuringAds: boolean): AdController;
17
17
  shouldContinueLiveStreamDuringAds(): boolean;
18
+ getLiveSyncPosition(): number | undefined;
18
19
  generateVastUrls(baseUrl: string, count: number): string[];
19
20
  }
20
21
  declare class AdBreakOrchestrator {
@@ -334,6 +334,18 @@ 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 LG_TEST_APP_ID = "com.hulu.plus";
338
+ var LG_TEST_APP_NAME = "Hulu";
339
+ var LG_TEST_CONTENT_URL = "https://www.hulu.com/live-tv";
340
+ var _lgTestDeviceId;
341
+ function getLgTestDeviceId() {
342
+ if (!_lgTestDeviceId) _lgTestDeviceId = createUuid();
343
+ return _lgTestDeviceId;
344
+ }
345
+ function isLgWebOS() {
346
+ if (typeof navigator === "undefined") return false;
347
+ return /Web0S|webOS|LG Browser|LGSTB|LGE/i.test(navigator.userAgent);
348
+ }
337
349
  function getDefaultAppId() {
338
350
  if (typeof navigator === "undefined") return AIRY_ANDROID_APP_ID;
339
351
  var ua = navigator.userAgent;
@@ -359,17 +371,20 @@ var ANDROID_ID_TYPES = /* @__PURE__ */ new Set([
359
371
  "adid"
360
372
  ]);
361
373
  function resolveVastEnvironmentSignals(isCtv) {
362
- var _ref, _bridgeSignals_limitAdTracking;
374
+ var _ref;
363
375
  var bridgeSignals = readNativeBridgeSignals();
364
- var deviceId = bridgeSignals.deviceId || readStoredDeviceId();
365
- var deviceIdType = bridgeSignals.deviceIdType || readStoredString("deviceIdType") || readStoredString("idtype") || inferDeviceIdType();
366
- var limitAdTracking = deviceId != null ? (_ref = (_bridgeSignals_limitAdTracking = bridgeSignals.limitAdTracking) !== null && _bridgeSignals_limitAdTracking !== void 0 ? _bridgeSignals_limitAdTracking : readStoredLimitAdTracking()) !== null && _ref !== void 0 ? _ref : false : void 0;
376
+ var platformDevice = readPlatformNativeDeviceId();
377
+ var lg = isCtv && isLgWebOS();
378
+ var deviceId = bridgeSignals.deviceId || readStoredDeviceId() || platformDevice.deviceId || (lg && platformDevice.limitAdTracking !== true ? getLgTestDeviceId() : void 0);
379
+ var deviceIdType = bridgeSignals.deviceIdType || readStoredString("deviceIdType") || readStoredString("idtype") || platformDevice.deviceIdType || inferDeviceIdType() || (lg ? "lgudid" : void 0);
380
+ var platformLat = bridgeSignals.deviceId ? bridgeSignals.limitAdTracking : platformDevice.limitAdTracking;
381
+ var limitAdTracking = deviceId != null ? (_ref = platformLat !== null && platformLat !== void 0 ? platformLat : readStoredLimitAdTracking()) !== null && _ref !== void 0 ? _ref : false : void 0;
367
382
  if (isCtv) {
368
383
  return _object_spread_props(_object_spread({
369
384
  isCtv: true,
370
- contentUrl: bridgeSignals.contentUrl || readStoredString("contentUrl") || AIRY_DEFAULT_CONTENT_URL,
371
- appId: bridgeSignals.appId || readStoredString("appId") || readStoredString("msid") || getDefaultAppId(),
372
- appName: bridgeSignals.appName || readStoredString("appName") || readStoredString("an") || AIRY_APP_NAME,
385
+ contentUrl: bridgeSignals.contentUrl || readStoredString("contentUrl") || (lg ? LG_TEST_CONTENT_URL : AIRY_DEFAULT_CONTENT_URL),
386
+ appId: bridgeSignals.appId || readStoredString("appId") || readStoredString("msid") || (lg ? LG_TEST_APP_ID : getDefaultAppId()),
387
+ appName: bridgeSignals.appName || readStoredString("appName") || readStoredString("an") || (lg ? LG_TEST_APP_NAME : AIRY_APP_NAME),
373
388
  sessionId: getOrCreateCtvSessionId()
374
389
  }, deviceId ? {
375
390
  deviceId: deviceId
@@ -434,6 +449,72 @@ function createUuid() {
434
449
  return nibble.toString(16);
435
450
  });
436
451
  }
452
+ function readPlatformNativeDeviceId() {
453
+ if (typeof window === "undefined") return {};
454
+ try {
455
+ var _window_webapis;
456
+ var adinfo = (_window_webapis = window.webapis) === null || _window_webapis === void 0 ? void 0 : _window_webapis.adinfo;
457
+ if (adinfo) {
458
+ var tifa = typeof adinfo.getTIFA === "function" ? adinfo.getTIFA() : adinfo.tifa;
459
+ if (typeof tifa === "string" && tifa && !isMacroPlaceholder(tifa)) {
460
+ var lat = typeof adinfo.isLATEnabled === "function" ? adinfo.isLATEnabled() : void 0;
461
+ return _object_spread({
462
+ deviceId: tifa,
463
+ deviceIdType: "tifa"
464
+ }, typeof lat === "boolean" ? {
465
+ limitAdTracking: lat
466
+ } : {});
467
+ }
468
+ }
469
+ } catch (unused) {}
470
+ try {
471
+ var webOSDev = window.webOSDev;
472
+ if (webOSDev) {
473
+ var _webOSDev_lgudid;
474
+ var lgudid = typeof webOSDev.LGUDID === "function" ? webOSDev.LGUDID() : (_webOSDev_lgudid = webOSDev.lgudid) !== null && _webOSDev_lgudid !== void 0 ? _webOSDev_lgudid : webOSDev.LGUDID;
475
+ if (typeof lgudid === "string" && lgudid) {
476
+ if (isZeroedAdId(lgudid)) {
477
+ return {
478
+ deviceIdType: "lgudid",
479
+ limitAdTracking: true
480
+ };
481
+ }
482
+ if (!isMacroPlaceholder(lgudid)) {
483
+ return {
484
+ deviceId: lgudid,
485
+ deviceIdType: "lgudid",
486
+ limitAdTracking: false
487
+ };
488
+ }
489
+ }
490
+ }
491
+ } catch (unused) {}
492
+ try {
493
+ var roku = window.Roku;
494
+ if (roku) {
495
+ var rida = typeof roku.getPublisherUniqueId === "function" ? roku.getPublisherUniqueId() : roku.rida;
496
+ if (typeof rida === "string" && rida && !isMacroPlaceholder(rida)) {
497
+ return {
498
+ deviceId: rida,
499
+ deviceIdType: "rida",
500
+ limitAdTracking: false
501
+ };
502
+ }
503
+ }
504
+ } catch (unused) {}
505
+ return {};
506
+ }
507
+ var ZEROED_AD_ID_PATTERNS = /* @__PURE__ */ new Set([
508
+ "38400000-8cf0-11bd-b23e-10b96e40000d",
509
+ "00000000-0000-0000-0000-000000000000"
510
+ ]);
511
+ function isMacroPlaceholder(value) {
512
+ var t = value.trim();
513
+ return !t || /^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%)$/.test(t) || /^(unknown|null|undefined|none|n\/a|\$\{[^}]+\})$/i.test(t) || ZEROED_AD_ID_PATTERNS.has(t.toLowerCase());
514
+ }
515
+ function isZeroedAdId(value) {
516
+ return ZEROED_AD_ID_PATTERNS.has(value.trim().toLowerCase());
517
+ }
437
518
  function readNativeBridgeSignals() {
438
519
  if (typeof window === "undefined") {
439
520
  return {};
@@ -774,7 +855,7 @@ var INLINE_DEVICE_MACRO_REPLACEMENTS = [
774
855
  }
775
856
  }
776
857
  ];
777
- function isMacroPlaceholder(value) {
858
+ function isMacroPlaceholder2(value) {
778
859
  if (value == null) return true;
779
860
  var trimmed = value.trim();
780
861
  if (!trimmed) return true;
@@ -833,11 +914,11 @@ function applyDeviceIdentityParams(params, ctx) {
833
914
  if (runtimeId) {
834
915
  params.set("rdid", runtimeId);
835
916
  params.set("idtype", runtimeType || tagType || "aaid");
836
- params.set("is_lat", latValue !== null && latValue !== void 0 ? latValue : isMacroPlaceholder(tagLat) ? "0" : tagLat);
917
+ params.set("is_lat", latValue !== null && latValue !== void 0 ? latValue : isMacroPlaceholder2(tagLat) ? "0" : tagLat);
837
918
  return;
838
919
  }
839
- var tagRdidValid = Boolean(tagRdid && !isMacroPlaceholder(tagRdid));
840
- var tagTypeValid = Boolean(tagType && !isMacroPlaceholder(tagType));
920
+ var tagRdidValid = Boolean(tagRdid && !isMacroPlaceholder2(tagRdid));
921
+ var tagTypeValid = Boolean(tagType && !isMacroPlaceholder2(tagType));
841
922
  if (tagRdidValid && tagTypeValid && runtimeType && !isEquivalentDeviceIdType(tagType, runtimeType)) {
842
923
  params.delete("rdid");
843
924
  params.delete("idtype");
@@ -845,10 +926,10 @@ function applyDeviceIdentityParams(params, ctx) {
845
926
  return;
846
927
  }
847
928
  if (tagRdidValid) {
848
- if (isMacroPlaceholder(tagType) && runtimeType) {
929
+ if (isMacroPlaceholder2(tagType) && runtimeType) {
849
930
  params.set("idtype", runtimeType);
850
931
  }
851
- if (isMacroPlaceholder(tagLat)) {
932
+ if (isMacroPlaceholder2(tagLat)) {
852
933
  params.set("is_lat", latValue !== null && latValue !== void 0 ? latValue : "0");
853
934
  }
854
935
  return;
@@ -1034,7 +1115,7 @@ function applyVastMacros(baseUrl, ctx) {
1034
1115
  }
1035
1116
  var staleKeys = [];
1036
1117
  params.forEach(function(value, key) {
1037
- if (isMacroPlaceholder(value)) {
1118
+ if (isMacroPlaceholder2(value)) {
1038
1119
  staleKeys.push(key);
1039
1120
  }
1040
1121
  });