stormcloud-video-player 0.8.79 → 0.8.80
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/stormcloud-vp.min.js +2 -2
- package/lib/Player.cjs +6 -0
- package/lib/Player.cjs.map +1 -1
- package/lib/Player.d.cts +2 -0
- package/lib/StormcloudPlayer.cjs +1138 -159
- package/lib/StormcloudPlayer.cjs.map +1 -1
- package/lib/StormcloudPlayer.d.cts +2 -0
- package/lib/index.cjs +1201 -161
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +2 -0
- package/lib/index.d.ts +63 -2
- package/lib/index.js +1201 -161
- package/lib/index.js.map +1 -1
- package/lib/player/AdBreakOrchestrator.cjs +419 -83
- package/lib/player/AdBreakOrchestrator.cjs.map +1 -1
- package/lib/player/AdConfigManager.cjs +735 -93
- package/lib/player/AdConfigManager.cjs.map +1 -1
- package/lib/player/AdTimingService.cjs +0 -9
- package/lib/player/AdTimingService.cjs.map +1 -1
- package/lib/player/FloorLadder.cjs +3 -0
- package/lib/player/FloorLadder.cjs.map +1 -1
- package/lib/player/HlsEngine.cjs +7 -1
- package/lib/player/HlsEngine.cjs.map +1 -1
- package/lib/player/HlsEngine.d.cts +1 -0
- package/lib/player/OptimizedPodRequest.cjs +4 -1
- package/lib/player/OptimizedPodRequest.cjs.map +1 -1
- package/lib/player/OptimizedPodRequest.d.cts +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +1138 -159
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +18 -1
- package/lib/players/HlsPlayer.cjs +1138 -159
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +1138 -159
- package/lib/players/index.cjs.map +1 -1
- package/lib/props.cjs +6 -0
- package/lib/props.cjs.map +1 -1
- package/lib/props.d.cts +2 -0
- package/lib/sdk/hlsAdPlayer.cjs +32 -3
- package/lib/sdk/hlsAdPlayer.cjs.map +1 -1
- package/lib/sdk/pal.cjs +10 -3
- package/lib/sdk/pal.cjs.map +1 -1
- package/lib/sdk/pal.d.cts +3 -0
- package/lib/types.d.cts +23 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +1201 -161
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.d.cts +2 -0
- package/lib/utils/__tests__/adSignals.test.cjs +25662 -0
- package/lib/utils/__tests__/adSignals.test.cjs.map +1 -0
- package/lib/utils/__tests__/adSignals.test.d.cts +2 -0
- package/lib/utils/adIdentity.cjs +421 -0
- package/lib/utils/adIdentity.cjs.map +1 -0
- package/lib/utils/adIdentity.d.cts +30 -0
- package/lib/utils/browserCompat.cjs +13 -0
- package/lib/utils/browserCompat.cjs.map +1 -1
- package/lib/utils/browserCompat.d.cts +2 -1
- package/lib/utils/contentMetadata.cjs +208 -0
- package/lib/utils/contentMetadata.cjs.map +1 -0
- package/lib/utils/contentMetadata.d.cts +15 -0
- package/lib/utils/ctvVastSignals.cjs +250 -181
- package/lib/utils/ctvVastSignals.cjs.map +1 -1
- package/lib/utils/deviceInfo.cjs +678 -0
- package/lib/utils/deviceInfo.cjs.map +1 -0
- package/lib/utils/deviceInfo.d.cts +43 -0
- package/lib/utils/screenActivity.cjs +125 -0
- package/lib/utils/screenActivity.cjs.map +1 -0
- package/lib/utils/screenActivity.d.cts +5 -0
- package/lib/utils/tracking.cjs +386 -56
- package/lib/utils/tracking.cjs.map +1 -1
- package/lib/utils/tracking.d.cts +1 -1
- package/lib/utils/vastEnvironmentSignals.cjs +255 -85
- package/lib/utils/vastEnvironmentSignals.cjs.map +1 -1
- package/lib/utils/vastEnvironmentSignals.d.cts +8 -2
- package/lib/utils/vastMacros.cjs +7 -0
- package/lib/utils/vastMacros.cjs.map +1 -1
- package/lib/utils/vastMacros.d.cts +1 -0
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -566,8 +566,264 @@ __export(index_exports, {
|
|
|
566
566
|
module.exports = __toCommonJS(index_exports);
|
|
567
567
|
// src/ui/StormcloudVideoPlayer.tsx
|
|
568
568
|
var import_react = __toESM(require("react"), 1);
|
|
569
|
+
// src/utils/adIdentity.ts
|
|
570
|
+
var GOOGLE_ID_TYPES = [
|
|
571
|
+
"aaid",
|
|
572
|
+
"adid",
|
|
573
|
+
"afai",
|
|
574
|
+
"idfa",
|
|
575
|
+
"lgudid",
|
|
576
|
+
"msai",
|
|
577
|
+
"rida",
|
|
578
|
+
"tifa",
|
|
579
|
+
"tvOS",
|
|
580
|
+
"vaid",
|
|
581
|
+
"vida",
|
|
582
|
+
"dpid"
|
|
583
|
+
];
|
|
584
|
+
var MAX_SESSION_ID_AGE_MS = 6 * 60 * 60 * 1e3;
|
|
585
|
+
var DEFAULT_SESSION_ID_MAX_AGE_MS = MAX_SESSION_ID_AGE_MS;
|
|
586
|
+
var DEFAULT_FALLBACK_DEVICE_ID_MAX_AGE_MS = 24 * 60 * 60 * 1e3;
|
|
587
|
+
var DEFAULT_LGUDID_TIMEOUT_MS = 1500;
|
|
588
|
+
var FALLBACK_DEVICE_ID_KEY = "stormcloud.ad.dpid.v2";
|
|
589
|
+
var SESSION_ID_KEY = "stormcloud.ad.sid.v2";
|
|
590
|
+
var LEGACY_SESSION_KEY = "stormcloud.ctv.sid";
|
|
591
|
+
var ZEROED_IDS = /* @__PURE__ */ new Set([
|
|
592
|
+
"00000000-0000-0000-0000-000000000000",
|
|
593
|
+
"38400000-8cf0-11bd-b23e-10b96e40000d"
|
|
594
|
+
]);
|
|
595
|
+
var hostIdentity;
|
|
596
|
+
var memoryStore = {};
|
|
597
|
+
var lgUdidResult;
|
|
598
|
+
var lgUdidPromise;
|
|
599
|
+
var legacyCleared = false;
|
|
600
|
+
function isUsableAdId(value) {
|
|
601
|
+
if (typeof value !== "string") return false;
|
|
602
|
+
var t = value.trim();
|
|
603
|
+
if (!t) return false;
|
|
604
|
+
if (/^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%|\$\{[^}]+\})$/.test(t)) return false;
|
|
605
|
+
if (/^(unknown|null|undefined|none|n\/a)$/i.test(t)) return false;
|
|
606
|
+
return !ZEROED_IDS.has(t.toLowerCase());
|
|
607
|
+
}
|
|
608
|
+
function isZeroedAdId(value) {
|
|
609
|
+
return typeof value === "string" && ZEROED_IDS.has(value.trim().toLowerCase());
|
|
610
|
+
}
|
|
611
|
+
function normalizeIdType(value) {
|
|
612
|
+
if (typeof value !== "string") return void 0;
|
|
613
|
+
var lower = value.trim().toLowerCase();
|
|
614
|
+
if (!lower) return void 0;
|
|
615
|
+
var match = GOOGLE_ID_TYPES.find(function(t) {
|
|
616
|
+
return t.toLowerCase() === lower;
|
|
617
|
+
});
|
|
618
|
+
return match !== null && match !== void 0 ? match : "dpid";
|
|
619
|
+
}
|
|
620
|
+
function createUuid() {
|
|
621
|
+
var _bytes_, _bytes_1, _bytes_i;
|
|
622
|
+
var c = typeof crypto !== "undefined" ? crypto : void 0;
|
|
623
|
+
if (c && typeof c.randomUUID === "function") return c.randomUUID();
|
|
624
|
+
var bytes = new Uint8Array(16);
|
|
625
|
+
if (c && typeof c.getRandomValues === "function") {
|
|
626
|
+
c.getRandomValues(bytes);
|
|
627
|
+
} else {
|
|
628
|
+
for(var i = 0; i < 16; i++)bytes[i] = Math.floor(Math.random() * 256);
|
|
629
|
+
}
|
|
630
|
+
bytes[6] = ((_bytes_ = bytes[6]) !== null && _bytes_ !== void 0 ? _bytes_ : 0) & 15 | 64;
|
|
631
|
+
bytes[8] = ((_bytes_1 = bytes[8]) !== null && _bytes_1 !== void 0 ? _bytes_1 : 0) & 63 | 128;
|
|
632
|
+
var hex = "";
|
|
633
|
+
for(var i1 = 0; i1 < 16; i1++)hex += ((_bytes_i = bytes[i1]) !== null && _bytes_i !== void 0 ? _bytes_i : 0).toString(16).padStart(2, "0");
|
|
634
|
+
return "".concat(hex.slice(0, 8), "-").concat(hex.slice(8, 12), "-").concat(hex.slice(12, 16), "-").concat(hex.slice(16, 20), "-").concat(hex.slice(20));
|
|
635
|
+
}
|
|
636
|
+
function readStored(key) {
|
|
637
|
+
try {
|
|
638
|
+
var _window_localStorage;
|
|
639
|
+
var raw = typeof window !== "undefined" ? (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.getItem(key) : null;
|
|
640
|
+
if (raw) {
|
|
641
|
+
var parsed = JSON.parse(raw);
|
|
642
|
+
if (parsed && typeof parsed.id === "string" && typeof parsed.createdAt === "number" && isFinite(parsed.createdAt)) {
|
|
643
|
+
return {
|
|
644
|
+
id: parsed.id,
|
|
645
|
+
createdAt: parsed.createdAt
|
|
646
|
+
};
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
} catch (unused) {}
|
|
650
|
+
return memoryStore[key];
|
|
651
|
+
}
|
|
652
|
+
function writeStored(key, value) {
|
|
653
|
+
memoryStore[key] = value;
|
|
654
|
+
try {
|
|
655
|
+
if (typeof window !== "undefined") {
|
|
656
|
+
var _window_localStorage;
|
|
657
|
+
(_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(key, JSON.stringify(value));
|
|
658
|
+
}
|
|
659
|
+
} catch (unused) {}
|
|
660
|
+
}
|
|
661
|
+
function removeStored(key) {
|
|
662
|
+
delete memoryStore[key];
|
|
663
|
+
try {
|
|
664
|
+
var _window_localStorage;
|
|
665
|
+
if (typeof window !== "undefined") (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.removeItem(key);
|
|
666
|
+
} catch (unused) {}
|
|
667
|
+
}
|
|
668
|
+
function clearLegacyIdsOnce() {
|
|
669
|
+
if (legacyCleared) return;
|
|
670
|
+
legacyCleared = true;
|
|
671
|
+
try {
|
|
672
|
+
var _window_localStorage;
|
|
673
|
+
if (typeof window !== "undefined") (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.removeItem(LEGACY_SESSION_KEY);
|
|
674
|
+
} catch (unused) {}
|
|
675
|
+
try {
|
|
676
|
+
if (typeof document !== "undefined") {
|
|
677
|
+
document.cookie = "".concat(encodeURIComponent(LEGACY_SESSION_KEY), "=;path=/;max-age=0;SameSite=Lax");
|
|
678
|
+
}
|
|
679
|
+
} catch (unused) {}
|
|
680
|
+
}
|
|
681
|
+
function clampAge(value, fallback, max) {
|
|
682
|
+
var v = typeof value === "number" && isFinite(value) && value > 0 ? value : fallback;
|
|
683
|
+
if (max != null) v = Math.min(v, max);
|
|
684
|
+
return v;
|
|
685
|
+
}
|
|
686
|
+
function setHostAdIdentity(identity) {
|
|
687
|
+
var _normalizeIdType;
|
|
688
|
+
if (!identity || !isUsableAdId(identity.deviceId)) {
|
|
689
|
+
hostIdentity = void 0;
|
|
690
|
+
return;
|
|
691
|
+
}
|
|
692
|
+
var deviceId = identity.deviceId.trim();
|
|
693
|
+
var changed = !hostIdentity || hostIdentity.deviceId !== deviceId;
|
|
694
|
+
hostIdentity = _object_spread({
|
|
695
|
+
deviceId: deviceId,
|
|
696
|
+
deviceIdType: (_normalizeIdType = normalizeIdType(identity.deviceIdType)) !== null && _normalizeIdType !== void 0 ? _normalizeIdType : "dpid"
|
|
697
|
+
}, typeof identity.limitAdTracking === "boolean" ? {
|
|
698
|
+
limitAdTracking: identity.limitAdTracking
|
|
699
|
+
} : {});
|
|
700
|
+
if (changed) {
|
|
701
|
+
removeStored(SESSION_ID_KEY);
|
|
702
|
+
removeStored(FALLBACK_DEVICE_ID_KEY);
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
function getHostAdIdentity() {
|
|
706
|
+
return hostIdentity ? _object_spread({}, hostIdentity) : void 0;
|
|
707
|
+
}
|
|
708
|
+
function resetAdIdentity() {
|
|
709
|
+
removeStored(SESSION_ID_KEY);
|
|
710
|
+
removeStored(FALLBACK_DEVICE_ID_KEY);
|
|
711
|
+
}
|
|
712
|
+
function readSamsungTifa() {
|
|
713
|
+
try {
|
|
714
|
+
var _window_webapis;
|
|
715
|
+
var adinfo = typeof window !== "undefined" ? (_window_webapis = window.webapis) === null || _window_webapis === void 0 ? void 0 : _window_webapis.adinfo : void 0;
|
|
716
|
+
if (!adinfo) return void 0;
|
|
717
|
+
var tifa = typeof adinfo.getTIFA === "function" ? adinfo.getTIFA() : adinfo.tifa;
|
|
718
|
+
var lat = typeof adinfo.isLATEnabled === "function" ? adinfo.isLATEnabled() : void 0;
|
|
719
|
+
if (isZeroedAdId(tifa)) return {
|
|
720
|
+
deviceIdType: "tifa",
|
|
721
|
+
limitAdTracking: true
|
|
722
|
+
};
|
|
723
|
+
if (!isUsableAdId(tifa)) return void 0;
|
|
724
|
+
return _object_spread({
|
|
725
|
+
deviceId: tifa.trim(),
|
|
726
|
+
deviceIdType: "tifa"
|
|
727
|
+
}, typeof lat === "boolean" ? {
|
|
728
|
+
limitAdTracking: lat
|
|
729
|
+
} : {});
|
|
730
|
+
} catch (unused) {
|
|
731
|
+
return void 0;
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
function primeLgUdid() {
|
|
735
|
+
var timeoutMs = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : DEFAULT_LGUDID_TIMEOUT_MS;
|
|
736
|
+
if (lgUdidResult || lgUdidPromise) return lgUdidPromise !== null && lgUdidPromise !== void 0 ? lgUdidPromise : Promise.resolve();
|
|
737
|
+
var dev = typeof window !== "undefined" ? window.webOSDev : void 0;
|
|
738
|
+
if (!dev) return Promise.resolve();
|
|
739
|
+
if (typeof dev.LGUDID !== "function") {
|
|
740
|
+
var _dev_lgudid;
|
|
741
|
+
var direct = (_dev_lgudid = dev.lgudid) !== null && _dev_lgudid !== void 0 ? _dev_lgudid : dev.LGUDID;
|
|
742
|
+
if (isZeroedAdId(direct)) lgUdidResult = {
|
|
743
|
+
deviceIdType: "lgudid",
|
|
744
|
+
limitAdTracking: true
|
|
745
|
+
};
|
|
746
|
+
else if (isUsableAdId(direct)) {
|
|
747
|
+
lgUdidResult = {
|
|
748
|
+
deviceId: direct.trim(),
|
|
749
|
+
deviceIdType: "lgudid",
|
|
750
|
+
limitAdTracking: false
|
|
751
|
+
};
|
|
752
|
+
}
|
|
753
|
+
return Promise.resolve();
|
|
754
|
+
}
|
|
755
|
+
lgUdidPromise = new Promise(function(resolve) {
|
|
756
|
+
var settled = false;
|
|
757
|
+
var finish = function finish() {
|
|
758
|
+
if (settled) return;
|
|
759
|
+
settled = true;
|
|
760
|
+
clearTimeout(timer);
|
|
761
|
+
resolve();
|
|
762
|
+
};
|
|
763
|
+
var timer = setTimeout(finish, Math.max(0, timeoutMs));
|
|
764
|
+
try {
|
|
765
|
+
dev.LGUDID({
|
|
766
|
+
onSuccess: function onSuccess(res) {
|
|
767
|
+
var id = res === null || res === void 0 ? void 0 : res.id;
|
|
768
|
+
if (isZeroedAdId(id)) {
|
|
769
|
+
lgUdidResult = {
|
|
770
|
+
deviceIdType: "lgudid",
|
|
771
|
+
limitAdTracking: true
|
|
772
|
+
};
|
|
773
|
+
} else if (isUsableAdId(id)) {
|
|
774
|
+
lgUdidResult = {
|
|
775
|
+
deviceId: id.trim(),
|
|
776
|
+
deviceIdType: "lgudid",
|
|
777
|
+
limitAdTracking: false
|
|
778
|
+
};
|
|
779
|
+
}
|
|
780
|
+
finish();
|
|
781
|
+
},
|
|
782
|
+
onFailure: function onFailure() {
|
|
783
|
+
return finish();
|
|
784
|
+
}
|
|
785
|
+
});
|
|
786
|
+
} catch (unused) {
|
|
787
|
+
finish();
|
|
788
|
+
}
|
|
789
|
+
});
|
|
790
|
+
return lgUdidPromise;
|
|
791
|
+
}
|
|
792
|
+
function readCachedLgUdid() {
|
|
793
|
+
return lgUdidResult ? _object_spread({}, lgUdidResult) : void 0;
|
|
794
|
+
}
|
|
795
|
+
function getOrRotateFallbackDeviceId() {
|
|
796
|
+
var maxAgeMs = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : DEFAULT_FALLBACK_DEVICE_ID_MAX_AGE_MS, now = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Date.now();
|
|
797
|
+
clearLegacyIdsOnce();
|
|
798
|
+
var age = clampAge(maxAgeMs, DEFAULT_FALLBACK_DEVICE_ID_MAX_AGE_MS);
|
|
799
|
+
var stored = readStored(FALLBACK_DEVICE_ID_KEY);
|
|
800
|
+
if (stored && isUsableAdId(stored.id) && now - stored.createdAt >= 0 && now - stored.createdAt < age) {
|
|
801
|
+
return stored.id;
|
|
802
|
+
}
|
|
803
|
+
var id = createUuid();
|
|
804
|
+
writeStored(FALLBACK_DEVICE_ID_KEY, {
|
|
805
|
+
id: id,
|
|
806
|
+
createdAt: now
|
|
807
|
+
});
|
|
808
|
+
return id;
|
|
809
|
+
}
|
|
810
|
+
function getOrRotateSessionId() {
|
|
811
|
+
var maxAgeMs = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : DEFAULT_SESSION_ID_MAX_AGE_MS, avoidValue = arguments.length > 1 ? arguments[1] : void 0, now = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Date.now();
|
|
812
|
+
clearLegacyIdsOnce();
|
|
813
|
+
var age = clampAge(maxAgeMs, DEFAULT_SESSION_ID_MAX_AGE_MS, MAX_SESSION_ID_AGE_MS);
|
|
814
|
+
var stored = readStored(SESSION_ID_KEY);
|
|
815
|
+
if (stored && isUsableAdId(stored.id) && stored.id !== avoidValue && now - stored.createdAt >= 0 && now - stored.createdAt < age) {
|
|
816
|
+
return stored.id;
|
|
817
|
+
}
|
|
818
|
+
var id = createUuid();
|
|
819
|
+
while(id === avoidValue)id = createUuid();
|
|
820
|
+
writeStored(SESSION_ID_KEY, {
|
|
821
|
+
id: id,
|
|
822
|
+
createdAt: now
|
|
823
|
+
});
|
|
824
|
+
return id;
|
|
825
|
+
}
|
|
569
826
|
// src/utils/vastEnvironmentSignals.ts
|
|
570
|
-
var CTV_SESSION_STORAGE_KEY = "stormcloud.ctv.sid";
|
|
571
827
|
var PLAYER_ID_STORAGE_KEY = "stormcloud.player.id";
|
|
572
828
|
var DEVICE_ID_STORAGE_KEYS = [
|
|
573
829
|
"rdid",
|
|
@@ -586,49 +842,96 @@ var ANDROID_ID_TYPES = /* @__PURE__ */ new Set([
|
|
|
586
842
|
"adid"
|
|
587
843
|
]);
|
|
588
844
|
function resolveVastEnvironmentSignals(isCtv) {
|
|
589
|
-
var
|
|
590
|
-
var platformDevice = readPlatformNativeDeviceId();
|
|
591
|
-
var bridgeDeviceId = validDeviceId(bridgeSignals.deviceId);
|
|
592
|
-
var realDeviceId = bridgeDeviceId || (isCtv ? validDeviceId(readStoredDeviceId()) : void 0) || validDeviceId(platformDevice.deviceId);
|
|
593
|
-
var deviceId = realDeviceId;
|
|
594
|
-
var deviceIdType = (bridgeDeviceId ? bridgeSignals.deviceIdType : void 0) || readStoredString("deviceIdType") || readStoredString("idtype") || platformDevice.deviceIdType || inferDeviceIdType();
|
|
595
|
-
var platformLat = bridgeDeviceId ? bridgeSignals.limitAdTracking : platformDevice.limitAdTracking;
|
|
596
|
-
var limitAdTracking = deviceId != null ? platformLat !== null && platformLat !== void 0 ? platformLat : readStoredLimitAdTracking() : void 0;
|
|
597
|
-
if (!deviceId && isCtv) {
|
|
598
|
-
var dpid = getOrCreateStoredUuid(PLAYER_ID_STORAGE_KEY);
|
|
599
|
-
if (dpid) {
|
|
600
|
-
deviceId = dpid;
|
|
601
|
-
deviceIdType = "dpid";
|
|
602
|
-
limitAdTracking = platformLat !== null && platformLat !== void 0 ? platformLat : readStoredLimitAdTracking();
|
|
603
|
-
}
|
|
604
|
-
}
|
|
845
|
+
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
605
846
|
var deviceTypeHint = resolveDeviceTypeHint(isCtv);
|
|
847
|
+
var identity = resolveDeviceIdentity(isCtv, options);
|
|
848
|
+
var identityFields = _object_spread({}, identity.deviceId ? {
|
|
849
|
+
deviceId: identity.deviceId
|
|
850
|
+
} : {}, identity.deviceId && identity.deviceIdType ? {
|
|
851
|
+
deviceIdType: identity.deviceIdType
|
|
852
|
+
} : {}, identity.deviceId && identity.limitAdTracking != null ? {
|
|
853
|
+
limitAdTracking: identity.limitAdTracking
|
|
854
|
+
} : {}, identity.source ? {
|
|
855
|
+
deviceIdSource: identity.source
|
|
856
|
+
} : {});
|
|
606
857
|
if (isCtv) {
|
|
607
858
|
return _object_spread_props(_object_spread({
|
|
608
859
|
isCtv: true,
|
|
609
|
-
sessionId:
|
|
610
|
-
},
|
|
611
|
-
deviceId: deviceId
|
|
612
|
-
} : {}, deviceId && deviceIdType ? {
|
|
613
|
-
deviceIdType: deviceIdType
|
|
614
|
-
} : {}, deviceId && limitAdTracking != null ? {
|
|
615
|
-
limitAdTracking: limitAdTracking
|
|
616
|
-
} : {}), {
|
|
860
|
+
sessionId: getOrRotateSessionId(options.sessionIdMaxAgeMs, identity.deviceId)
|
|
861
|
+
}, identityFields), {
|
|
617
862
|
deviceTypeHint: deviceTypeHint
|
|
618
863
|
});
|
|
619
864
|
}
|
|
620
865
|
return _object_spread_props(_object_spread({
|
|
621
866
|
isCtv: false
|
|
622
|
-
},
|
|
623
|
-
deviceId: deviceId
|
|
624
|
-
} : {}, deviceId && deviceIdType ? {
|
|
625
|
-
deviceIdType: deviceIdType
|
|
626
|
-
} : {}, deviceId && limitAdTracking != null ? {
|
|
627
|
-
limitAdTracking: limitAdTracking
|
|
628
|
-
} : {}), {
|
|
867
|
+
}, identityFields), {
|
|
629
868
|
deviceTypeHint: deviceTypeHint
|
|
630
869
|
});
|
|
631
870
|
}
|
|
871
|
+
function resolveDeviceIdentity(isCtv, options) {
|
|
872
|
+
var _platform_limitAdTracking;
|
|
873
|
+
var host = getHostAdIdentity();
|
|
874
|
+
if (host) {
|
|
875
|
+
var _host_deviceIdType;
|
|
876
|
+
return _object_spread_props(_object_spread({
|
|
877
|
+
deviceId: host.deviceId,
|
|
878
|
+
deviceIdType: (_host_deviceIdType = host.deviceIdType) !== null && _host_deviceIdType !== void 0 ? _host_deviceIdType : "dpid"
|
|
879
|
+
}, host.limitAdTracking != null ? {
|
|
880
|
+
limitAdTracking: host.limitAdTracking
|
|
881
|
+
} : {}), {
|
|
882
|
+
source: "host"
|
|
883
|
+
});
|
|
884
|
+
}
|
|
885
|
+
var bridge = readNativeBridgeSignals();
|
|
886
|
+
var bridgeDeviceId = validDeviceId(bridge.deviceId);
|
|
887
|
+
if (bridgeDeviceId) {
|
|
888
|
+
var _normalizeIdType;
|
|
889
|
+
return _object_spread_props(_object_spread({
|
|
890
|
+
deviceId: bridgeDeviceId,
|
|
891
|
+
deviceIdType: (_normalizeIdType = normalizeIdType(bridge.deviceIdType)) !== null && _normalizeIdType !== void 0 ? _normalizeIdType : "dpid"
|
|
892
|
+
}, bridge.limitAdTracking != null ? {
|
|
893
|
+
limitAdTracking: bridge.limitAdTracking
|
|
894
|
+
} : {}), {
|
|
895
|
+
source: "bridge"
|
|
896
|
+
});
|
|
897
|
+
}
|
|
898
|
+
var platform = readPlatformNativeDeviceId();
|
|
899
|
+
var platformDeviceId = validDeviceId(platform.deviceId);
|
|
900
|
+
if (platformDeviceId) {
|
|
901
|
+
var _platform_deviceIdType;
|
|
902
|
+
return _object_spread_props(_object_spread({
|
|
903
|
+
deviceId: platformDeviceId,
|
|
904
|
+
deviceIdType: (_platform_deviceIdType = platform.deviceIdType) !== null && _platform_deviceIdType !== void 0 ? _platform_deviceIdType : "dpid"
|
|
905
|
+
}, platform.limitAdTracking != null ? {
|
|
906
|
+
limitAdTracking: platform.limitAdTracking
|
|
907
|
+
} : {}), {
|
|
908
|
+
source: "platform"
|
|
909
|
+
});
|
|
910
|
+
}
|
|
911
|
+
if (!isCtv) return {};
|
|
912
|
+
var storedDeviceId = validDeviceId(readStoredDeviceId());
|
|
913
|
+
if (storedDeviceId) {
|
|
914
|
+
var _normalizeIdType1;
|
|
915
|
+
var storedLat = readStoredLimitAdTracking();
|
|
916
|
+
return _object_spread_props(_object_spread({
|
|
917
|
+
deviceId: storedDeviceId,
|
|
918
|
+
deviceIdType: (_normalizeIdType1 = normalizeIdType(readStoredString("deviceIdType") || readStoredString("idtype"))) !== null && _normalizeIdType1 !== void 0 ? _normalizeIdType1 : "dpid"
|
|
919
|
+
}, storedLat != null ? {
|
|
920
|
+
limitAdTracking: storedLat
|
|
921
|
+
} : {}), {
|
|
922
|
+
source: "stored"
|
|
923
|
+
});
|
|
924
|
+
}
|
|
925
|
+
var fallbackLat = (_platform_limitAdTracking = platform.limitAdTracking) !== null && _platform_limitAdTracking !== void 0 ? _platform_limitAdTracking : readStoredLimitAdTracking();
|
|
926
|
+
return _object_spread_props(_object_spread({
|
|
927
|
+
deviceId: getOrRotateFallbackDeviceId(options.fallbackDeviceIdMaxAgeMs),
|
|
928
|
+
deviceIdType: "dpid"
|
|
929
|
+
}, fallbackLat != null ? {
|
|
930
|
+
limitAdTracking: fallbackLat
|
|
931
|
+
} : {}), {
|
|
932
|
+
source: "generated"
|
|
933
|
+
});
|
|
934
|
+
}
|
|
632
935
|
var DEVICE_TYPE_HINT = {
|
|
633
936
|
FEATURE_PHONE: 1,
|
|
634
937
|
SMARTPHONE: 2,
|
|
@@ -789,7 +1092,7 @@ function resolveNativeDeviceId() {
|
|
|
789
1092
|
var bridgeSignals = readNativeBridgeSignals();
|
|
790
1093
|
var platformDevice = readPlatformNativeDeviceId();
|
|
791
1094
|
var deviceId = bridgeSignals.deviceId || (includeStored ? readStoredDeviceId() : void 0) || platformDevice.deviceId;
|
|
792
|
-
if (!deviceId || isMacroPlaceholder(deviceId) ||
|
|
1095
|
+
if (!deviceId || isMacroPlaceholder(deviceId) || isZeroedAdId2(deviceId)) {
|
|
793
1096
|
return void 0;
|
|
794
1097
|
}
|
|
795
1098
|
return deviceId;
|
|
@@ -803,20 +1106,10 @@ function getOrCreateStoredUuid(storageKey) {
|
|
|
803
1106
|
writePersistentId(storageKey, existing);
|
|
804
1107
|
return existing;
|
|
805
1108
|
}
|
|
806
|
-
var id =
|
|
1109
|
+
var id = createUuid2();
|
|
807
1110
|
writePersistentId(storageKey, id);
|
|
808
1111
|
return id;
|
|
809
1112
|
}
|
|
810
|
-
function getOrCreateCtvSessionId() {
|
|
811
|
-
var existing = readPersistentId(CTV_SESSION_STORAGE_KEY);
|
|
812
|
-
if (existing) {
|
|
813
|
-
writePersistentId(CTV_SESSION_STORAGE_KEY, existing);
|
|
814
|
-
return existing;
|
|
815
|
-
}
|
|
816
|
-
var sessionId = createUuid();
|
|
817
|
-
writePersistentId(CTV_SESSION_STORAGE_KEY, sessionId);
|
|
818
|
-
return sessionId;
|
|
819
|
-
}
|
|
820
1113
|
function readPersistentId(storageKey) {
|
|
821
1114
|
return readStoredString(storageKey) || readCookie(storageKey);
|
|
822
1115
|
}
|
|
@@ -869,7 +1162,7 @@ function writeCookie(name, value) {
|
|
|
869
1162
|
document.cookie = encodeURIComponent(name) + "=" + encodeURIComponent(value) + ";path=/;max-age=" + PERSISTENT_ID_COOKIE_MAX_AGE + ";SameSite=Lax";
|
|
870
1163
|
} catch (unused) {}
|
|
871
1164
|
}
|
|
872
|
-
function
|
|
1165
|
+
function createUuid2() {
|
|
873
1166
|
var _bytes_, _bytes_1;
|
|
874
1167
|
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
875
1168
|
return crypto.randomUUID();
|
|
@@ -903,44 +1196,10 @@ function performanceNow() {
|
|
|
903
1196
|
}
|
|
904
1197
|
function readPlatformNativeDeviceId() {
|
|
905
1198
|
if (typeof window === "undefined") return {};
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
var tifa = typeof adinfo.getTIFA === "function" ? adinfo.getTIFA() : adinfo.tifa;
|
|
911
|
-
if (typeof tifa === "string" && tifa && !isMacroPlaceholder(tifa)) {
|
|
912
|
-
var lat = typeof adinfo.isLATEnabled === "function" ? adinfo.isLATEnabled() : void 0;
|
|
913
|
-
return _object_spread({
|
|
914
|
-
deviceId: tifa,
|
|
915
|
-
deviceIdType: "tifa"
|
|
916
|
-
}, typeof lat === "boolean" ? {
|
|
917
|
-
limitAdTracking: lat
|
|
918
|
-
} : {});
|
|
919
|
-
}
|
|
920
|
-
}
|
|
921
|
-
} catch (unused) {}
|
|
922
|
-
try {
|
|
923
|
-
var webOSDev = window.webOSDev;
|
|
924
|
-
if (webOSDev) {
|
|
925
|
-
var _webOSDev_lgudid;
|
|
926
|
-
var lgudid = typeof webOSDev.LGUDID === "function" ? webOSDev.LGUDID() : (_webOSDev_lgudid = webOSDev.lgudid) !== null && _webOSDev_lgudid !== void 0 ? _webOSDev_lgudid : webOSDev.LGUDID;
|
|
927
|
-
if (typeof lgudid === "string" && lgudid) {
|
|
928
|
-
if (isZeroedAdId(lgudid)) {
|
|
929
|
-
return {
|
|
930
|
-
deviceIdType: "lgudid",
|
|
931
|
-
limitAdTracking: true
|
|
932
|
-
};
|
|
933
|
-
}
|
|
934
|
-
if (!isMacroPlaceholder(lgudid)) {
|
|
935
|
-
return {
|
|
936
|
-
deviceId: lgudid,
|
|
937
|
-
deviceIdType: "lgudid",
|
|
938
|
-
limitAdTracking: false
|
|
939
|
-
};
|
|
940
|
-
}
|
|
941
|
-
}
|
|
942
|
-
}
|
|
943
|
-
} catch (unused) {}
|
|
1199
|
+
var tifa = readSamsungTifa();
|
|
1200
|
+
if (tifa) return tifa;
|
|
1201
|
+
var lgudid = readCachedLgUdid();
|
|
1202
|
+
if (lgudid) return lgudid;
|
|
944
1203
|
try {
|
|
945
1204
|
var roku = window.Roku;
|
|
946
1205
|
if (roku) {
|
|
@@ -967,7 +1226,7 @@ function isMacroPlaceholder(value) {
|
|
|
967
1226
|
function validDeviceId(value) {
|
|
968
1227
|
return value && !isMacroPlaceholder(value) ? value : void 0;
|
|
969
1228
|
}
|
|
970
|
-
function
|
|
1229
|
+
function isZeroedAdId2(value) {
|
|
971
1230
|
return ZEROED_AD_ID_PATTERNS.has(value.trim().toLowerCase());
|
|
972
1231
|
}
|
|
973
1232
|
function readNativeBridgeSignals() {
|
|
@@ -1011,7 +1270,7 @@ function readNativeBridgeSignals() {
|
|
|
1011
1270
|
"deviceIdType",
|
|
1012
1271
|
"advertisingIdType",
|
|
1013
1272
|
"idType"
|
|
1014
|
-
]) ||
|
|
1273
|
+
]) || void 0;
|
|
1015
1274
|
var limitAdTracking = readBridgeBoolean(source, [
|
|
1016
1275
|
"is_lat",
|
|
1017
1276
|
"limitAdTracking",
|
|
@@ -1559,6 +1818,7 @@ function resolveScvpMacroValues(ctx) {
|
|
|
1559
1818
|
set("GIVN", ctx.palNonce);
|
|
1560
1819
|
set("CT-TI", ctx.programTitle);
|
|
1561
1820
|
set("CT-CH", ctx.channelName);
|
|
1821
|
+
set("CT-NE", ctx.contentNetwork);
|
|
1562
1822
|
set("POD", ctx.pod);
|
|
1563
1823
|
set("CORRELATOR", ctx.correlator);
|
|
1564
1824
|
set("SCOR", ctx.streamCorrelator);
|
|
@@ -1787,6 +2047,9 @@ function applyVastMacros(baseUrl, ctx) {
|
|
|
1787
2047
|
if (ctx.channelName) {
|
|
1788
2048
|
params.set("ct_ch", ctx.channelName);
|
|
1789
2049
|
}
|
|
2050
|
+
if (ctx.contentNetwork) {
|
|
2051
|
+
params.set("ct_ne", ctx.contentNetwork);
|
|
2052
|
+
}
|
|
1790
2053
|
var staleKeys = [];
|
|
1791
2054
|
params.forEach(function(value, key) {
|
|
1792
2055
|
if (isMacroPlaceholder2(value)) {
|
|
@@ -2460,8 +2723,17 @@ function detectBrowser() {
|
|
|
2460
2723
|
chromeVersion: chromeVersionNum
|
|
2461
2724
|
};
|
|
2462
2725
|
}
|
|
2726
|
+
var singleDecoderOverride;
|
|
2727
|
+
function setSingleDecoderOverride(value) {
|
|
2728
|
+
singleDecoderOverride = value;
|
|
2729
|
+
}
|
|
2463
2730
|
function requiresMediaPipelineResetAfterAds() {
|
|
2464
2731
|
var _browser_tizenVersion;
|
|
2732
|
+
if (singleDecoderOverride != null) return singleDecoderOverride;
|
|
2733
|
+
try {
|
|
2734
|
+
var globalOverride = typeof window !== "undefined" ? window.__STORMCLOUD_SINGLE_DECODER__ : void 0;
|
|
2735
|
+
if (typeof globalOverride === "boolean") return globalOverride;
|
|
2736
|
+
} catch (unused) {}
|
|
2465
2737
|
var browser = detectBrowser();
|
|
2466
2738
|
return browser.name === "Samsung Tizen" && ((_browser_tizenVersion = browser.tizenVersion) !== null && _browser_tizenVersion !== void 0 ? _browser_tizenVersion : 0) >= 5;
|
|
2467
2739
|
}
|
|
@@ -2644,7 +2916,7 @@ function substituteVastTrackingMacros(url) {
|
|
|
2644
2916
|
});
|
|
2645
2917
|
}
|
|
2646
2918
|
// src/player/OptimizedPodRequest.ts
|
|
2647
|
-
var DEFAULT_REQUEST_SAFETY_MS =
|
|
2919
|
+
var DEFAULT_REQUEST_SAFETY_MS = 2500;
|
|
2648
2920
|
var GAM_AD_OPPORTUNITY_DURATION_MS = 3e4;
|
|
2649
2921
|
var POD_PARAM_KEYS = [
|
|
2650
2922
|
"pmnd",
|
|
@@ -3068,6 +3340,9 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
3068
3340
|
var mediaCandidateIndex = 0;
|
|
3069
3341
|
var mediaStartTimerId;
|
|
3070
3342
|
var MEDIA_START_TIMEOUT_MS = (_ref = options === null || options === void 0 ? void 0 : options.mediaStartTimeoutMs) !== null && _ref !== void 0 ? _ref : 8e3;
|
|
3343
|
+
var MAX_MEDIA_START_ATTEMPTS = 2;
|
|
3344
|
+
var MEDIA_START_TOTAL_BUDGET_MS = Math.max(MEDIA_START_TIMEOUT_MS, 1e4);
|
|
3345
|
+
var mediaStartBudgetStartedAt = 0;
|
|
3071
3346
|
var VAST_ERROR_MEDIA_TIMEOUT = 402;
|
|
3072
3347
|
var pendingVastRequests = /* @__PURE__ */ new Set();
|
|
3073
3348
|
var pendingRequestAbortReason;
|
|
@@ -5082,12 +5357,14 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
5082
5357
|
clearMediaStartTimer();
|
|
5083
5358
|
if (!(MEDIA_START_TIMEOUT_MS > 0)) return;
|
|
5084
5359
|
var startedAt = Date.now();
|
|
5360
|
+
var budgetLeftMs = mediaStartBudgetStartedAt > 0 ? MEDIA_START_TOTAL_BUDGET_MS - (startedAt - mediaStartBudgetStartedAt) : MEDIA_START_TIMEOUT_MS;
|
|
5361
|
+
var timeoutMs = Math.max(1e3, Math.min(MEDIA_START_TIMEOUT_MS, budgetLeftMs));
|
|
5085
5362
|
mediaStartTimerId = setTimeout(function() {
|
|
5086
5363
|
mediaStartTimerId = void 0;
|
|
5087
5364
|
if (!adPlaying || trackingFired.impression) return;
|
|
5088
|
-
console.warn("[HlsAdPlayer] Ad media did not start playing within ".concat(
|
|
5365
|
+
console.warn("[HlsAdPlayer] Ad media did not start playing within ".concat(timeoutMs, "ms"));
|
|
5089
5366
|
logFunnel("play_resolved_but_never_started", {
|
|
5090
|
-
timeoutMs:
|
|
5367
|
+
timeoutMs: timeoutMs,
|
|
5091
5368
|
elapsedMs: Date.now() - startedAt,
|
|
5092
5369
|
readyState: adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.readyState,
|
|
5093
5370
|
networkState: adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.networkState,
|
|
@@ -5096,7 +5373,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
5096
5373
|
vastErrorCode: VAST_ERROR_MEDIA_TIMEOUT
|
|
5097
5374
|
});
|
|
5098
5375
|
recoverFromAdFailure(VAST_ERROR_MEDIA_TIMEOUT);
|
|
5099
|
-
},
|
|
5376
|
+
}, timeoutMs);
|
|
5100
5377
|
}
|
|
5101
5378
|
function resetVideoElementForNextSource() {
|
|
5102
5379
|
clearStallWatchdog();
|
|
@@ -5111,6 +5388,20 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
5111
5388
|
function tryNextMediaCandidate() {
|
|
5112
5389
|
if (!currentAd || trackingFired.impression) return false;
|
|
5113
5390
|
if (mediaCandidateIndex >= mediaCandidates.length - 1) return false;
|
|
5391
|
+
if (mediaCandidateIndex + 1 >= MAX_MEDIA_START_ATTEMPTS) {
|
|
5392
|
+
logFunnel("media_fallback_capped", {
|
|
5393
|
+
reason: "max_attempts",
|
|
5394
|
+
attempts: mediaCandidateIndex + 1
|
|
5395
|
+
});
|
|
5396
|
+
return false;
|
|
5397
|
+
}
|
|
5398
|
+
if (mediaStartBudgetStartedAt > 0 && Date.now() - mediaStartBudgetStartedAt >= MEDIA_START_TOTAL_BUDGET_MS) {
|
|
5399
|
+
logFunnel("media_fallback_capped", {
|
|
5400
|
+
reason: "time_budget",
|
|
5401
|
+
elapsedMs: Date.now() - mediaStartBudgetStartedAt
|
|
5402
|
+
});
|
|
5403
|
+
return false;
|
|
5404
|
+
}
|
|
5114
5405
|
var failedUrl = currentAdMediaFile === null || currentAdMediaFile === void 0 ? void 0 : currentAdMediaFile.url;
|
|
5115
5406
|
mediaCandidateIndex++;
|
|
5116
5407
|
var next = mediaCandidates[mediaCandidateIndex];
|
|
@@ -5144,6 +5435,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
5144
5435
|
}
|
|
5145
5436
|
mediaCandidates = rankMediaCandidates(currentAd.mediaFiles);
|
|
5146
5437
|
mediaCandidateIndex = 0;
|
|
5438
|
+
mediaStartBudgetStartedAt = Date.now();
|
|
5147
5439
|
var mediaFile = mediaCandidates[0];
|
|
5148
5440
|
if (!mediaFile) {
|
|
5149
5441
|
logFunnel("media_unsupported", {
|
|
@@ -6083,6 +6375,7 @@ function getOrCreateNonceLoader(allowStorage) {
|
|
|
6083
6375
|
}
|
|
6084
6376
|
function createPalNonceManager() {
|
|
6085
6377
|
var currentNonce = "";
|
|
6378
|
+
var currentNonceCreatedAt = 0;
|
|
6086
6379
|
var currentNonceManager;
|
|
6087
6380
|
var pendingNonce;
|
|
6088
6381
|
return {
|
|
@@ -6099,6 +6392,9 @@ function createPalNonceManager() {
|
|
|
6099
6392
|
getCurrentNonce: function getCurrentNonce() {
|
|
6100
6393
|
return currentNonce;
|
|
6101
6394
|
},
|
|
6395
|
+
getNonceAgeMs: function getNonceAgeMs() {
|
|
6396
|
+
return currentNonce ? Date.now() - currentNonceCreatedAt : void 0;
|
|
6397
|
+
},
|
|
6102
6398
|
waitForNonce: function waitForNonce(maxWaitMs) {
|
|
6103
6399
|
if (currentNonce) return Promise.resolve(currentNonce);
|
|
6104
6400
|
var pending = pendingNonce;
|
|
@@ -6151,13 +6447,14 @@ function createPalNonceManager() {
|
|
|
6151
6447
|
},
|
|
6152
6448
|
reset: function reset() {
|
|
6153
6449
|
currentNonce = "";
|
|
6450
|
+
currentNonceCreatedAt = 0;
|
|
6154
6451
|
currentNonceManager = void 0;
|
|
6155
6452
|
pendingNonce = void 0;
|
|
6156
6453
|
}
|
|
6157
6454
|
};
|
|
6158
6455
|
function generate(options) {
|
|
6159
6456
|
return _async_to_generator(function() {
|
|
6160
|
-
var _options_allowStorage, _options_adWillAutoPlay, _options_adWillPlayMuted, _options_playerVolume, _options_continuousPlayback, loader, goog, request, manager, error;
|
|
6457
|
+
var _options_allowStorage, _options_adWillAutoPlay, _options_adWillPlayMuted, _options_playerVolume, _options_continuousPlayback, _options_iconsSupported, _options_supportedApiFrameworks, loader, goog, request, apiFrameworks, manager, error;
|
|
6161
6458
|
return _ts_generator(this, function(_state) {
|
|
6162
6459
|
switch(_state.label){
|
|
6163
6460
|
case 0:
|
|
@@ -6181,10 +6478,11 @@ function createPalNonceManager() {
|
|
|
6181
6478
|
request.playerVolume = (_options_playerVolume = options.playerVolume) !== null && _options_playerVolume !== void 0 ? _options_playerVolume : request.adWillPlayMuted ? 0 : 1;
|
|
6182
6479
|
request.continuousPlayback = (_options_continuousPlayback = options.continuousPlayback) !== null && _options_continuousPlayback !== void 0 ? _options_continuousPlayback : true;
|
|
6183
6480
|
request.descriptionUrl = toDevSafeUrl(options.descriptionUrl || (typeof window !== "undefined" ? window.location.href : ""));
|
|
6184
|
-
request.iconsSupported =
|
|
6481
|
+
request.iconsSupported = (_options_iconsSupported = options.iconsSupported) !== null && _options_iconsSupported !== void 0 ? _options_iconsSupported : false;
|
|
6185
6482
|
request.playerType = "StormcloudVideoPlayer";
|
|
6186
6483
|
request.playerVersion = "1.0";
|
|
6187
|
-
|
|
6484
|
+
apiFrameworks = ((_options_supportedApiFrameworks = options.supportedApiFrameworks) !== null && _options_supportedApiFrameworks !== void 0 ? _options_supportedApiFrameworks : "").trim();
|
|
6485
|
+
if (apiFrameworks) request.supportedApiFrameworks = apiFrameworks;
|
|
6188
6486
|
request.url = toDevSafeUrl(options.descriptionUrl || (typeof window !== "undefined" ? window.location.href : ""));
|
|
6189
6487
|
request.videoWidth = options.videoWidth || 640;
|
|
6190
6488
|
request.videoHeight = options.videoHeight || 480;
|
|
@@ -6214,6 +6512,7 @@ function createPalNonceManager() {
|
|
|
6214
6512
|
manager = _state.sent();
|
|
6215
6513
|
currentNonceManager = manager;
|
|
6216
6514
|
currentNonce = manager.getNonce();
|
|
6515
|
+
currentNonceCreatedAt = Date.now();
|
|
6217
6516
|
console.log("[PAL] Nonce generated successfully");
|
|
6218
6517
|
return [
|
|
6219
6518
|
2,
|
|
@@ -6237,6 +6536,549 @@ function createPalNonceManager() {
|
|
|
6237
6536
|
})();
|
|
6238
6537
|
}
|
|
6239
6538
|
}
|
|
6539
|
+
// src/utils/deviceInfo.ts
|
|
6540
|
+
var CATEGORY_CODES = {
|
|
6541
|
+
"LG TV": "lg_tv",
|
|
6542
|
+
"LG Set-Top Box": "lg_stb",
|
|
6543
|
+
"Samsung TV": "samsung_tv",
|
|
6544
|
+
Other: "other"
|
|
6545
|
+
};
|
|
6546
|
+
var DEVICE_CATEGORIES = [
|
|
6547
|
+
"LG TV",
|
|
6548
|
+
"LG Set-Top Box",
|
|
6549
|
+
"Samsung TV",
|
|
6550
|
+
"Other"
|
|
6551
|
+
];
|
|
6552
|
+
var hostDeviceInfo;
|
|
6553
|
+
var lgDeviceInfo;
|
|
6554
|
+
var platformCache;
|
|
6555
|
+
var primePromise;
|
|
6556
|
+
function cleanString(value) {
|
|
6557
|
+
var maxLength = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 128;
|
|
6558
|
+
if (typeof value !== "string") return void 0;
|
|
6559
|
+
var t = value.replace(/[\u0000-\u001f\u007f]/g, " ").replace(/\s+/g, " ").trim();
|
|
6560
|
+
if (!t || /^(unknown|null|undefined|none|n\/a|-|0)$/i.test(t)) return void 0;
|
|
6561
|
+
return t.length > maxLength ? t.slice(0, maxLength) : t;
|
|
6562
|
+
}
|
|
6563
|
+
function safeCall2(fn, thisArg) {
|
|
6564
|
+
if (typeof fn !== "function") return void 0;
|
|
6565
|
+
try {
|
|
6566
|
+
return fn.call(thisArg);
|
|
6567
|
+
} catch (unused) {
|
|
6568
|
+
return void 0;
|
|
6569
|
+
}
|
|
6570
|
+
}
|
|
6571
|
+
function userAgent() {
|
|
6572
|
+
return typeof navigator !== "undefined" ? navigator.userAgent || "" : "";
|
|
6573
|
+
}
|
|
6574
|
+
function bridgeSources() {
|
|
6575
|
+
if (typeof window === "undefined") return [];
|
|
6576
|
+
var w = window;
|
|
6577
|
+
return [
|
|
6578
|
+
w.__STORMCLOUD_CTV__,
|
|
6579
|
+
w.__STORMCLOUD_CTV_AD_INFO__,
|
|
6580
|
+
w.stormcloudCtv
|
|
6581
|
+
].filter(Boolean);
|
|
6582
|
+
}
|
|
6583
|
+
function readBridge(keys) {
|
|
6584
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
6585
|
+
try {
|
|
6586
|
+
for(var _iterator = bridgeSources()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
6587
|
+
var source = _step.value;
|
|
6588
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
6589
|
+
try {
|
|
6590
|
+
for(var _iterator1 = keys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
6591
|
+
var key = _step1.value;
|
|
6592
|
+
var value = void 0;
|
|
6593
|
+
try {
|
|
6594
|
+
value = source === null || source === void 0 ? void 0 : source[key];
|
|
6595
|
+
if (typeof value === "function") value = value.call(source);
|
|
6596
|
+
} catch (unused) {
|
|
6597
|
+
value = void 0;
|
|
6598
|
+
}
|
|
6599
|
+
var clean = cleanString(value);
|
|
6600
|
+
if (clean) return clean;
|
|
6601
|
+
}
|
|
6602
|
+
} catch (err) {
|
|
6603
|
+
_didIteratorError1 = true;
|
|
6604
|
+
_iteratorError1 = err;
|
|
6605
|
+
} finally{
|
|
6606
|
+
try {
|
|
6607
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
6608
|
+
_iterator1.return();
|
|
6609
|
+
}
|
|
6610
|
+
} finally{
|
|
6611
|
+
if (_didIteratorError1) {
|
|
6612
|
+
throw _iteratorError1;
|
|
6613
|
+
}
|
|
6614
|
+
}
|
|
6615
|
+
}
|
|
6616
|
+
}
|
|
6617
|
+
} catch (err) {
|
|
6618
|
+
_didIteratorError = true;
|
|
6619
|
+
_iteratorError = err;
|
|
6620
|
+
} finally{
|
|
6621
|
+
try {
|
|
6622
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
6623
|
+
_iterator.return();
|
|
6624
|
+
}
|
|
6625
|
+
} finally{
|
|
6626
|
+
if (_didIteratorError) {
|
|
6627
|
+
throw _iteratorError;
|
|
6628
|
+
}
|
|
6629
|
+
}
|
|
6630
|
+
}
|
|
6631
|
+
return void 0;
|
|
6632
|
+
}
|
|
6633
|
+
function normalizeCategory(value) {
|
|
6634
|
+
var v = cleanString(value);
|
|
6635
|
+
if (!v) return void 0;
|
|
6636
|
+
var exact = DEVICE_CATEGORIES.find(function(c) {
|
|
6637
|
+
return c.toLowerCase() === v.toLowerCase();
|
|
6638
|
+
});
|
|
6639
|
+
if (exact) return exact;
|
|
6640
|
+
var code = v.toLowerCase().replace(/[\s-]+/g, "_");
|
|
6641
|
+
var byCode = Object.keys(CATEGORY_CODES).find(function(c) {
|
|
6642
|
+
return CATEGORY_CODES[c] === code;
|
|
6643
|
+
});
|
|
6644
|
+
return byCode;
|
|
6645
|
+
}
|
|
6646
|
+
function parseUserAgentDeviceInfo(ua) {
|
|
6647
|
+
var sources = [];
|
|
6648
|
+
var out = {
|
|
6649
|
+
platform: "other",
|
|
6650
|
+
sources: sources
|
|
6651
|
+
};
|
|
6652
|
+
var chrome = ua.match(/(?:Chrome|PCBR)\/(\d+)\./) || ua.match(/\s(\d{2,3})\.\d+\.\d+\.\d+\/[\d.]+\s+TV\b/);
|
|
6653
|
+
if (chrome && chrome[1]) out.browserMajorVersion = parseInt(chrome[1], 10);
|
|
6654
|
+
if (/Web0S|webOS/i.test(ua)) {
|
|
6655
|
+
out.platform = "webos";
|
|
6656
|
+
var lg = ua.match(/LGE\s*;\s*([A-Za-z0-9][A-Za-z0-9._-]*)\s*;\s*(\d{2}\.\d{2}\.\d{2})/);
|
|
6657
|
+
if (lg && lg[1] && lg[2]) {
|
|
6658
|
+
out.model = lg[1];
|
|
6659
|
+
out.firmware = lg[2];
|
|
6660
|
+
sources.push("user_agent");
|
|
6661
|
+
}
|
|
6662
|
+
} else if (/Tizen/i.test(ua)) {
|
|
6663
|
+
out.platform = "tizen";
|
|
6664
|
+
var tizen = ua.match(/Tizen\s+(\d+(?:\.\d+)*)/i);
|
|
6665
|
+
if (tizen && tizen[1]) {
|
|
6666
|
+
out.osVersion = "Tizen ".concat(tizen[1]);
|
|
6667
|
+
sources.push("user_agent");
|
|
6668
|
+
}
|
|
6669
|
+
}
|
|
6670
|
+
return out;
|
|
6671
|
+
}
|
|
6672
|
+
function readSamsungProductInfo() {
|
|
6673
|
+
var _cleanString;
|
|
6674
|
+
var _window_webapis;
|
|
6675
|
+
if (typeof window === "undefined") return void 0;
|
|
6676
|
+
var productinfo = (_window_webapis = window.webapis) === null || _window_webapis === void 0 ? void 0 : _window_webapis.productinfo;
|
|
6677
|
+
if (!productinfo) return void 0;
|
|
6678
|
+
var model = (_cleanString = cleanString(safeCall2(productinfo.getRealModel, productinfo), 40)) !== null && _cleanString !== void 0 ? _cleanString : cleanString(safeCall2(productinfo.getModel, productinfo), 40);
|
|
6679
|
+
var firmware = cleanString(safeCall2(productinfo.getFirmware, productinfo), 64);
|
|
6680
|
+
var duid = cleanString(safeCall2(productinfo.getDuid, productinfo), 128);
|
|
6681
|
+
if (!model && !firmware && !duid) return void 0;
|
|
6682
|
+
return _object_spread({}, model ? {
|
|
6683
|
+
model: model
|
|
6684
|
+
} : {}, firmware ? {
|
|
6685
|
+
firmware: firmware
|
|
6686
|
+
} : {}, duid ? {
|
|
6687
|
+
internalDeviceId: duid,
|
|
6688
|
+
internalDeviceIdSource: "samsung_duid"
|
|
6689
|
+
} : {});
|
|
6690
|
+
}
|
|
6691
|
+
function readLgDeviceInfo(timeoutMs) {
|
|
6692
|
+
var webOS = typeof window !== "undefined" ? window.webOS : void 0;
|
|
6693
|
+
if (lgDeviceInfo || !webOS || typeof webOS.deviceInfo !== "function") return Promise.resolve();
|
|
6694
|
+
return new Promise(function(resolve) {
|
|
6695
|
+
var settled = false;
|
|
6696
|
+
var finish = function finish() {
|
|
6697
|
+
if (settled) return;
|
|
6698
|
+
settled = true;
|
|
6699
|
+
clearTimeout(timer);
|
|
6700
|
+
resolve();
|
|
6701
|
+
};
|
|
6702
|
+
var timer = setTimeout(finish, Math.max(0, timeoutMs));
|
|
6703
|
+
try {
|
|
6704
|
+
webOS.deviceInfo(function(info) {
|
|
6705
|
+
var model = cleanString(info === null || info === void 0 ? void 0 : info.modelName, 40);
|
|
6706
|
+
var firmware = cleanString(info === null || info === void 0 ? void 0 : info.version, 64);
|
|
6707
|
+
var sdkVersion = cleanString(info === null || info === void 0 ? void 0 : info.sdkVersion, 32);
|
|
6708
|
+
lgDeviceInfo = _object_spread({}, model ? {
|
|
6709
|
+
model: model
|
|
6710
|
+
} : {}, firmware ? {
|
|
6711
|
+
firmware: firmware
|
|
6712
|
+
} : {}, sdkVersion ? {
|
|
6713
|
+
sdkVersion: sdkVersion
|
|
6714
|
+
} : {});
|
|
6715
|
+
finish();
|
|
6716
|
+
});
|
|
6717
|
+
} catch (unused) {
|
|
6718
|
+
finish();
|
|
6719
|
+
}
|
|
6720
|
+
});
|
|
6721
|
+
}
|
|
6722
|
+
function computePlatformInfo() {
|
|
6723
|
+
var info = parseUserAgentDeviceInfo(userAgent());
|
|
6724
|
+
var sources = _to_consumable_array(info.sources);
|
|
6725
|
+
var samsung = readSamsungProductInfo();
|
|
6726
|
+
if (samsung) {
|
|
6727
|
+
info.platform = "tizen";
|
|
6728
|
+
if (samsung.model) info.model = samsung.model;
|
|
6729
|
+
if (samsung.firmware) info.firmware = samsung.firmware;
|
|
6730
|
+
if (samsung.internalDeviceId) {
|
|
6731
|
+
info.internalDeviceId = samsung.internalDeviceId;
|
|
6732
|
+
info.internalDeviceIdSource = "samsung_duid";
|
|
6733
|
+
}
|
|
6734
|
+
sources.push("samsung_productinfo");
|
|
6735
|
+
}
|
|
6736
|
+
if (lgDeviceInfo) {
|
|
6737
|
+
info.platform = "webos";
|
|
6738
|
+
if (!info.model && lgDeviceInfo.model) info.model = lgDeviceInfo.model;
|
|
6739
|
+
if (!info.firmware && lgDeviceInfo.firmware) info.firmware = lgDeviceInfo.firmware;
|
|
6740
|
+
if (lgDeviceInfo.sdkVersion) info.osVersion = "webOS TV ".concat(lgDeviceInfo.sdkVersion);
|
|
6741
|
+
sources.push("lg_deviceinfo");
|
|
6742
|
+
}
|
|
6743
|
+
var lgUdid = readCachedLgUdid();
|
|
6744
|
+
if ((lgUdid === null || lgUdid === void 0 ? void 0 : lgUdid.deviceId) && !info.internalDeviceId) {
|
|
6745
|
+
info.internalDeviceId = lgUdid.deviceId;
|
|
6746
|
+
info.internalDeviceIdSource = "lg_udid";
|
|
6747
|
+
sources.push("lg_udid");
|
|
6748
|
+
}
|
|
6749
|
+
info.sources = sources;
|
|
6750
|
+
return info;
|
|
6751
|
+
}
|
|
6752
|
+
function categorize(platform, model) {
|
|
6753
|
+
if (platform === "tizen") return "Samsung TV";
|
|
6754
|
+
if (platform === "webos") {
|
|
6755
|
+
var ua = userAgent();
|
|
6756
|
+
if (model && /^STB-/i.test(model) || /\bSTB-\d{4}|LGSTB/i.test(ua)) return "LG Set-Top Box";
|
|
6757
|
+
return "LG TV";
|
|
6758
|
+
}
|
|
6759
|
+
return "Other";
|
|
6760
|
+
}
|
|
6761
|
+
function setHostDeviceInfo(info) {
|
|
6762
|
+
hostDeviceInfo = info ? _object_spread({}, info) : void 0;
|
|
6763
|
+
}
|
|
6764
|
+
function primeDeviceInfo() {
|
|
6765
|
+
var timeoutMs = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 1500;
|
|
6766
|
+
if (!primePromise) {
|
|
6767
|
+
primePromise = Promise.all([
|
|
6768
|
+
readLgDeviceInfo(timeoutMs),
|
|
6769
|
+
primeLgUdid(timeoutMs)
|
|
6770
|
+
]).catch(function() {
|
|
6771
|
+
return void 0;
|
|
6772
|
+
}).then(function() {
|
|
6773
|
+
platformCache = computePlatformInfo();
|
|
6774
|
+
return getDeviceInfo();
|
|
6775
|
+
});
|
|
6776
|
+
}
|
|
6777
|
+
return primePromise;
|
|
6778
|
+
}
|
|
6779
|
+
function getDeviceInfo() {
|
|
6780
|
+
var _cleanString, _cleanString1, _ref, _cleanString2, _ref1, _cleanString3, _ref2, _normalizeCategory;
|
|
6781
|
+
var platform = platformCache !== null && platformCache !== void 0 ? platformCache : computePlatformInfo();
|
|
6782
|
+
if (primePromise && !platformCache) {} else {
|
|
6783
|
+
platformCache = platform;
|
|
6784
|
+
}
|
|
6785
|
+
var host = hostDeviceInfo !== null && hostDeviceInfo !== void 0 ? hostDeviceInfo : {};
|
|
6786
|
+
var bridge = {
|
|
6787
|
+
terminalId: readBridge([
|
|
6788
|
+
"terminalId",
|
|
6789
|
+
"terminal_id"
|
|
6790
|
+
]),
|
|
6791
|
+
internalDeviceId: readBridge([
|
|
6792
|
+
"internalDeviceId",
|
|
6793
|
+
"internal_device_id"
|
|
6794
|
+
]),
|
|
6795
|
+
model: readBridge([
|
|
6796
|
+
"deviceModel"
|
|
6797
|
+
]),
|
|
6798
|
+
firmware: readBridge([
|
|
6799
|
+
"firmwareVersion"
|
|
6800
|
+
]),
|
|
6801
|
+
category: normalizeCategory(readBridge([
|
|
6802
|
+
"deviceCategory"
|
|
6803
|
+
]))
|
|
6804
|
+
};
|
|
6805
|
+
var terminalId = (_cleanString = cleanString(host.terminalId)) !== null && _cleanString !== void 0 ? _cleanString : bridge.terminalId;
|
|
6806
|
+
var hostInternalId = (_cleanString1 = cleanString(host.internalDeviceId)) !== null && _cleanString1 !== void 0 ? _cleanString1 : bridge.internalDeviceId;
|
|
6807
|
+
var model = (_ref = (_cleanString2 = cleanString(host.model, 40)) !== null && _cleanString2 !== void 0 ? _cleanString2 : bridge.model) !== null && _ref !== void 0 ? _ref : platform.model;
|
|
6808
|
+
var firmware = (_ref1 = (_cleanString3 = cleanString(host.firmware, 64)) !== null && _cleanString3 !== void 0 ? _cleanString3 : bridge.firmware) !== null && _ref1 !== void 0 ? _ref1 : platform.firmware;
|
|
6809
|
+
var category = (_ref2 = (_normalizeCategory = normalizeCategory(host.category)) !== null && _normalizeCategory !== void 0 ? _normalizeCategory : bridge.category) !== null && _ref2 !== void 0 ? _ref2 : categorize(platform.platform, model);
|
|
6810
|
+
var sources = _to_consumable_array(platform.sources);
|
|
6811
|
+
var bridgeValues = [
|
|
6812
|
+
bridge.terminalId,
|
|
6813
|
+
bridge.internalDeviceId,
|
|
6814
|
+
bridge.model,
|
|
6815
|
+
bridge.firmware,
|
|
6816
|
+
bridge.category
|
|
6817
|
+
];
|
|
6818
|
+
if (bridgeValues.some(function(v) {
|
|
6819
|
+
return v !== void 0;
|
|
6820
|
+
})) sources.unshift("bridge");
|
|
6821
|
+
if (hostDeviceInfo) sources.unshift("host");
|
|
6822
|
+
var internalDeviceId = hostInternalId !== null && hostInternalId !== void 0 ? hostInternalId : platform.internalDeviceId;
|
|
6823
|
+
var internalDeviceIdSource = hostInternalId ? "host" : platform.internalDeviceIdSource;
|
|
6824
|
+
var sonifiModel = model && category === "Samsung TV" && !/^SAMSUNG-IPTV-/i.test(model) ? "SAMSUNG-IPTV-".concat(model) : model;
|
|
6825
|
+
return _object_spread_props(_object_spread({
|
|
6826
|
+
category: category,
|
|
6827
|
+
categoryCode: CATEGORY_CODES[category]
|
|
6828
|
+
}, model ? {
|
|
6829
|
+
model: model
|
|
6830
|
+
} : {}, sonifiModel ? {
|
|
6831
|
+
sonifiModel: sonifiModel
|
|
6832
|
+
} : {}, firmware ? {
|
|
6833
|
+
firmware: firmware
|
|
6834
|
+
} : {}, platform.osVersion ? {
|
|
6835
|
+
osVersion: platform.osVersion
|
|
6836
|
+
} : {}, platform.browserMajorVersion != null ? {
|
|
6837
|
+
browserMajorVersion: platform.browserMajorVersion
|
|
6838
|
+
} : {}, internalDeviceId ? {
|
|
6839
|
+
internalDeviceId: internalDeviceId
|
|
6840
|
+
} : {}, internalDeviceId && internalDeviceIdSource ? {
|
|
6841
|
+
internalDeviceIdSource: internalDeviceIdSource
|
|
6842
|
+
} : {}, terminalId ? {
|
|
6843
|
+
terminalId: terminalId
|
|
6844
|
+
} : {}), {
|
|
6845
|
+
sources: sources
|
|
6846
|
+
});
|
|
6847
|
+
}
|
|
6848
|
+
var DEVICE_KEY_VALUE_KEYS = {
|
|
6849
|
+
category: "sc_dev",
|
|
6850
|
+
model: "sc_model",
|
|
6851
|
+
firmware: "sc_fw"
|
|
6852
|
+
};
|
|
6853
|
+
function sanitizeKeyValue(value) {
|
|
6854
|
+
if (typeof value !== "string") return void 0;
|
|
6855
|
+
var v = value.trim().replace(/[^A-Za-z0-9._-]+/g, "_").replace(/^_+|_+$/g, "");
|
|
6856
|
+
return v ? v.slice(0, 40) : void 0;
|
|
6857
|
+
}
|
|
6858
|
+
function deviceKeyValuePairs(info) {
|
|
6859
|
+
var pairs = [
|
|
6860
|
+
[
|
|
6861
|
+
DEVICE_KEY_VALUE_KEYS.category,
|
|
6862
|
+
info.categoryCode
|
|
6863
|
+
]
|
|
6864
|
+
];
|
|
6865
|
+
var model = sanitizeKeyValue(info.model);
|
|
6866
|
+
var firmware = sanitizeKeyValue(info.firmware);
|
|
6867
|
+
if (model) pairs.push([
|
|
6868
|
+
DEVICE_KEY_VALUE_KEYS.model,
|
|
6869
|
+
model
|
|
6870
|
+
]);
|
|
6871
|
+
if (firmware) pairs.push([
|
|
6872
|
+
DEVICE_KEY_VALUE_KEYS.firmware,
|
|
6873
|
+
firmware
|
|
6874
|
+
]);
|
|
6875
|
+
return pairs;
|
|
6876
|
+
}
|
|
6877
|
+
function applyDeviceKeyValues(url, info) {
|
|
6878
|
+
try {
|
|
6879
|
+
var parsed = new URL(url);
|
|
6880
|
+
var pairs = deviceKeyValuePairs(info);
|
|
6881
|
+
var ours = new Set(pairs.map(function(param) {
|
|
6882
|
+
var _param = _sliced_to_array(param, 1), k = _param[0];
|
|
6883
|
+
return k;
|
|
6884
|
+
}));
|
|
6885
|
+
var existing = (parsed.searchParams.get("cust_params") || "").split("&").filter(function(p) {
|
|
6886
|
+
var _p_split_;
|
|
6887
|
+
return p !== "" && !ours.has((_p_split_ = p.split("=")[0]) !== null && _p_split_ !== void 0 ? _p_split_ : "");
|
|
6888
|
+
});
|
|
6889
|
+
var merged = existing.concat(pairs.map(function(param) {
|
|
6890
|
+
var _param = _sliced_to_array(param, 2), k = _param[0], v = _param[1];
|
|
6891
|
+
return "".concat(k, "=").concat(v);
|
|
6892
|
+
})).join("&");
|
|
6893
|
+
parsed.searchParams.set("cust_params", merged);
|
|
6894
|
+
return parsed.toString();
|
|
6895
|
+
} catch (unused) {
|
|
6896
|
+
return url;
|
|
6897
|
+
}
|
|
6898
|
+
}
|
|
6899
|
+
function deviceInfoAnalyticsFields(info) {
|
|
6900
|
+
return _object_spread({
|
|
6901
|
+
device_category: info.category
|
|
6902
|
+
}, info.model ? {
|
|
6903
|
+
device_model: info.model
|
|
6904
|
+
} : {}, info.sonifiModel ? {
|
|
6905
|
+
sonifi_model: info.sonifiModel
|
|
6906
|
+
} : {}, info.firmware ? {
|
|
6907
|
+
firmware_version: info.firmware
|
|
6908
|
+
} : {}, info.osVersion ? {
|
|
6909
|
+
os_version: info.osVersion
|
|
6910
|
+
} : {}, info.browserMajorVersion != null ? {
|
|
6911
|
+
browser_major_version: info.browserMajorVersion
|
|
6912
|
+
} : {}, info.internalDeviceId ? {
|
|
6913
|
+
internal_device_id: info.internalDeviceId
|
|
6914
|
+
} : {}, info.internalDeviceIdSource ? {
|
|
6915
|
+
internal_device_id_source: info.internalDeviceIdSource
|
|
6916
|
+
} : {}, info.terminalId ? {
|
|
6917
|
+
terminal_id: info.terminalId
|
|
6918
|
+
} : {});
|
|
6919
|
+
}
|
|
6920
|
+
// src/utils/contentMetadata.ts
|
|
6921
|
+
var MAX_CONTENT_VALUE_LENGTH = 128;
|
|
6922
|
+
var BRIDGE_KEYS = {
|
|
6923
|
+
channelName: [
|
|
6924
|
+
"channelName",
|
|
6925
|
+
"ct_ch"
|
|
6926
|
+
],
|
|
6927
|
+
programTitle: [
|
|
6928
|
+
"programTitle",
|
|
6929
|
+
"ct_ti"
|
|
6930
|
+
],
|
|
6931
|
+
contentNetwork: [
|
|
6932
|
+
"contentNetwork",
|
|
6933
|
+
"ct_ne"
|
|
6934
|
+
]
|
|
6935
|
+
};
|
|
6936
|
+
function sanitizeContentValue(value) {
|
|
6937
|
+
if (typeof value !== "string") return void 0;
|
|
6938
|
+
var cleaned = value.replace(/[\u0000-\u001f\u007f]/g, " ").replace(/\s+/g, " ").trim();
|
|
6939
|
+
if (!cleaned) return void 0;
|
|
6940
|
+
if (/^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%|\$\{[^}]+\})$/.test(cleaned)) return void 0;
|
|
6941
|
+
if (/^(unknown|null|undefined|none|n\/a|-)$/i.test(cleaned)) return void 0;
|
|
6942
|
+
return cleaned.length > MAX_CONTENT_VALUE_LENGTH ? cleaned.slice(0, MAX_CONTENT_VALUE_LENGTH).trim() : cleaned;
|
|
6943
|
+
}
|
|
6944
|
+
function bridgeSources2() {
|
|
6945
|
+
if (typeof window === "undefined") return [];
|
|
6946
|
+
var w = window;
|
|
6947
|
+
return [
|
|
6948
|
+
w.__STORMCLOUD_CTV__,
|
|
6949
|
+
w.__STORMCLOUD_CTV_AD_INFO__,
|
|
6950
|
+
w.stormcloudCtv
|
|
6951
|
+
].filter(Boolean);
|
|
6952
|
+
}
|
|
6953
|
+
function readBridgeContentValue(keys) {
|
|
6954
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
6955
|
+
try {
|
|
6956
|
+
for(var _iterator = bridgeSources2()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
6957
|
+
var source = _step.value;
|
|
6958
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
6959
|
+
try {
|
|
6960
|
+
for(var _iterator1 = keys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
6961
|
+
var key = _step1.value;
|
|
6962
|
+
var value = void 0;
|
|
6963
|
+
try {
|
|
6964
|
+
value = source === null || source === void 0 ? void 0 : source[key];
|
|
6965
|
+
if (typeof value === "function") value = value.call(source);
|
|
6966
|
+
} catch (unused) {
|
|
6967
|
+
value = void 0;
|
|
6968
|
+
}
|
|
6969
|
+
var sanitized = sanitizeContentValue(value);
|
|
6970
|
+
if (sanitized) return sanitized;
|
|
6971
|
+
}
|
|
6972
|
+
} catch (err) {
|
|
6973
|
+
_didIteratorError1 = true;
|
|
6974
|
+
_iteratorError1 = err;
|
|
6975
|
+
} finally{
|
|
6976
|
+
try {
|
|
6977
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
6978
|
+
_iterator1.return();
|
|
6979
|
+
}
|
|
6980
|
+
} finally{
|
|
6981
|
+
if (_didIteratorError1) {
|
|
6982
|
+
throw _iteratorError1;
|
|
6983
|
+
}
|
|
6984
|
+
}
|
|
6985
|
+
}
|
|
6986
|
+
}
|
|
6987
|
+
} catch (err) {
|
|
6988
|
+
_didIteratorError = true;
|
|
6989
|
+
_iteratorError = err;
|
|
6990
|
+
} finally{
|
|
6991
|
+
try {
|
|
6992
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
6993
|
+
_iterator.return();
|
|
6994
|
+
}
|
|
6995
|
+
} finally{
|
|
6996
|
+
if (_didIteratorError) {
|
|
6997
|
+
throw _iteratorError;
|
|
6998
|
+
}
|
|
6999
|
+
}
|
|
7000
|
+
}
|
|
7001
|
+
return void 0;
|
|
7002
|
+
}
|
|
7003
|
+
function resolveContentMetadata(config) {
|
|
7004
|
+
var _sanitizeContentValue, _sanitizeContentValue1, _sanitizeContentValue2;
|
|
7005
|
+
var channelName = (_sanitizeContentValue = sanitizeContentValue(config.channelName)) !== null && _sanitizeContentValue !== void 0 ? _sanitizeContentValue : readBridgeContentValue(BRIDGE_KEYS.channelName);
|
|
7006
|
+
var programTitle = (_sanitizeContentValue1 = sanitizeContentValue(config.programTitle)) !== null && _sanitizeContentValue1 !== void 0 ? _sanitizeContentValue1 : readBridgeContentValue(BRIDGE_KEYS.programTitle);
|
|
7007
|
+
var contentNetwork = (_sanitizeContentValue2 = sanitizeContentValue(config.contentNetwork)) !== null && _sanitizeContentValue2 !== void 0 ? _sanitizeContentValue2 : readBridgeContentValue(BRIDGE_KEYS.contentNetwork);
|
|
7008
|
+
return _object_spread({}, channelName ? {
|
|
7009
|
+
channelName: channelName
|
|
7010
|
+
} : {}, programTitle ? {
|
|
7011
|
+
programTitle: programTitle
|
|
7012
|
+
} : {}, contentNetwork ? {
|
|
7013
|
+
contentNetwork: contentNetwork
|
|
7014
|
+
} : {});
|
|
7015
|
+
}
|
|
7016
|
+
function appendMissingContentParams(url, meta) {
|
|
7017
|
+
if (!meta.channelName && !meta.programTitle && !meta.contentNetwork) return url;
|
|
7018
|
+
try {
|
|
7019
|
+
var parsed = new URL(url);
|
|
7020
|
+
var add = function add(key, value) {
|
|
7021
|
+
if (value && !parsed.searchParams.has(key)) parsed.searchParams.set(key, value);
|
|
7022
|
+
};
|
|
7023
|
+
add("ct_ch", meta.channelName);
|
|
7024
|
+
add("ct_ti", meta.programTitle);
|
|
7025
|
+
add("ct_ne", meta.contentNetwork);
|
|
7026
|
+
return parsed.toString();
|
|
7027
|
+
} catch (unused) {
|
|
7028
|
+
return url;
|
|
7029
|
+
}
|
|
7030
|
+
}
|
|
7031
|
+
// src/utils/screenActivity.ts
|
|
7032
|
+
var hostStandby = false;
|
|
7033
|
+
function setHostStandby(standby) {
|
|
7034
|
+
hostStandby = !!standby;
|
|
7035
|
+
}
|
|
7036
|
+
function toBoolean(value) {
|
|
7037
|
+
if (typeof value === "boolean") return value;
|
|
7038
|
+
if (typeof value === "number") return value === 1;
|
|
7039
|
+
if (typeof value === "string") {
|
|
7040
|
+
var v = value.trim().toLowerCase();
|
|
7041
|
+
if (v === "true" || v === "1" || v === "yes") return true;
|
|
7042
|
+
if (v === "false" || v === "0" || v === "no") return false;
|
|
7043
|
+
}
|
|
7044
|
+
return void 0;
|
|
7045
|
+
}
|
|
7046
|
+
function bridgeSaysStandby() {
|
|
7047
|
+
if (typeof window === "undefined") return false;
|
|
7048
|
+
var w = window;
|
|
7049
|
+
for(var _i = 0, _iter = [
|
|
7050
|
+
w.__STORMCLOUD_CTV__,
|
|
7051
|
+
w.__STORMCLOUD_CTV_AD_INFO__,
|
|
7052
|
+
w.stormcloudCtv
|
|
7053
|
+
]; _i < _iter.length; _i++){
|
|
7054
|
+
var source = _iter[_i];
|
|
7055
|
+
if (!source) continue;
|
|
7056
|
+
for(var _i1 = 0, _iter1 = [
|
|
7057
|
+
"standby",
|
|
7058
|
+
"isStandby",
|
|
7059
|
+
"screenOff"
|
|
7060
|
+
]; _i1 < _iter1.length; _i1++){
|
|
7061
|
+
var key = _iter1[_i1];
|
|
7062
|
+
var value = void 0;
|
|
7063
|
+
try {
|
|
7064
|
+
value = source[key];
|
|
7065
|
+
if (typeof value === "function") value = value.call(source);
|
|
7066
|
+
} catch (unused) {
|
|
7067
|
+
value = void 0;
|
|
7068
|
+
}
|
|
7069
|
+
if (toBoolean(value) === true) return true;
|
|
7070
|
+
}
|
|
7071
|
+
}
|
|
7072
|
+
return false;
|
|
7073
|
+
}
|
|
7074
|
+
function getScreenInactiveReason() {
|
|
7075
|
+
if (hostStandby) return "host_standby";
|
|
7076
|
+
if (typeof document !== "undefined" && document.visibilityState === "hidden") {
|
|
7077
|
+
return "document_hidden";
|
|
7078
|
+
}
|
|
7079
|
+
if (bridgeSaysStandby()) return "bridge_standby";
|
|
7080
|
+
return void 0;
|
|
7081
|
+
}
|
|
6240
7082
|
// src/utils/trackingIngest.ts
|
|
6241
7083
|
var DEFAULT_TRACKING_INGEST_CONFIG = {
|
|
6242
7084
|
enabled: true,
|
|
@@ -6340,6 +7182,9 @@ function buildAnalyticsContext(config) {
|
|
|
6340
7182
|
if (config.isLiveStream !== void 0) {
|
|
6341
7183
|
context.inputStreamType = config.isLiveStream ? "live" : "vod";
|
|
6342
7184
|
}
|
|
7185
|
+
if (config.sendDeviceInfoToAnalytics) {
|
|
7186
|
+
context.includeDeviceInfo = true;
|
|
7187
|
+
}
|
|
6343
7188
|
return context;
|
|
6344
7189
|
}
|
|
6345
7190
|
function getClientInfo() {
|
|
@@ -6635,7 +7480,7 @@ function buildPlayerMetricEvent() {
|
|
|
6635
7480
|
capture_at: captureAt
|
|
6636
7481
|
}, context.inputStreamType ? {
|
|
6637
7482
|
input_stream_type: context.inputStreamType
|
|
6638
|
-
} : {})
|
|
7483
|
+
} : {}, context.includeDeviceInfo ? deviceInfoAnalyticsFields(getDeviceInfo()) : {})
|
|
6639
7484
|
];
|
|
6640
7485
|
}
|
|
6641
7486
|
});
|
|
@@ -8663,7 +9508,11 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
8663
9508
|
key: "generatePodVastUrl",
|
|
8664
9509
|
value: function generatePodVastUrl(baseUrl, adPlayer, palNonce, inAdBreak) {
|
|
8665
9510
|
var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
|
|
8666
|
-
var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest
|
|
9511
|
+
var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest, {
|
|
9512
|
+
fallbackDeviceIdMaxAgeMs: this.config.fallbackDeviceIdMaxAgeMs,
|
|
9513
|
+
sessionIdMaxAgeMs: this.config.sessionIdMaxAgeMs
|
|
9514
|
+
});
|
|
9515
|
+
var content = resolveContentMetadata(this.config);
|
|
8667
9516
|
var macroContext = _object_spread_props(_object_spread({
|
|
8668
9517
|
correlator: this.viewCorrelator,
|
|
8669
9518
|
streamCorrelator: this.streamCorrelator,
|
|
@@ -8678,10 +9527,12 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
8678
9527
|
limitAdTracking: envSignals.limitAdTracking,
|
|
8679
9528
|
deviceTypeHint: envSignals.deviceTypeHint,
|
|
8680
9529
|
adTest: this.config.adTest
|
|
8681
|
-
},
|
|
8682
|
-
programTitle:
|
|
8683
|
-
} : {},
|
|
8684
|
-
channelName:
|
|
9530
|
+
}, content.programTitle ? {
|
|
9531
|
+
programTitle: content.programTitle
|
|
9532
|
+
} : {}, content.channelName ? {
|
|
9533
|
+
channelName: content.channelName
|
|
9534
|
+
} : {}, content.contentNetwork ? {
|
|
9535
|
+
contentNetwork: content.contentNetwork
|
|
8685
9536
|
} : {}), {
|
|
8686
9537
|
consent: this.consentSignals,
|
|
8687
9538
|
palNonce: palNonce.getCurrentNonce() || void 0
|
|
@@ -8699,6 +9550,24 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
8699
9550
|
} else {
|
|
8700
9551
|
finalUrl = withDeferredPodParams(palNonce.injectNonce(ensureVideoAdType(applyVastMacros(baseUrl, macroContext))), !nonceReady);
|
|
8701
9552
|
}
|
|
9553
|
+
finalUrl = appendMissingContentParams(finalUrl, content);
|
|
9554
|
+
if (this.config.ctvAdRequest && this.config.sendDeviceKeyValues !== false) {
|
|
9555
|
+
finalUrl = applyDeviceKeyValues(finalUrl, getDeviceInfo());
|
|
9556
|
+
}
|
|
9557
|
+
if (this.debug) {
|
|
9558
|
+
var id = envSignals.deviceId;
|
|
9559
|
+
console.log("[AD-IDENTITY]", {
|
|
9560
|
+
source: envSignals.deviceIdSource,
|
|
9561
|
+
idtype: envSignals.deviceIdType,
|
|
9562
|
+
rdidTail: id ? id.slice(-4) : void 0,
|
|
9563
|
+
isLat: envSignals.limitAdTracking,
|
|
9564
|
+
dth: envSignals.deviceTypeHint,
|
|
9565
|
+
sidTail: envSignals.sessionId ? envSignals.sessionId.slice(-4) : void 0,
|
|
9566
|
+
ct_ch: content.channelName,
|
|
9567
|
+
ct_ti: content.programTitle,
|
|
9568
|
+
ct_ne: content.contentNetwork
|
|
9569
|
+
});
|
|
9570
|
+
}
|
|
8702
9571
|
console.log("[StormcloudVideoPlayer] Prepared optimized-pod request URL (pod=".concat(this.podCounter, "; pmnd/pmxd/pmad resolved at dispatch):"), finalUrl);
|
|
8703
9572
|
return finalUrl;
|
|
8704
9573
|
}
|
|
@@ -8750,7 +9619,6 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
8750
9619
|
}
|
|
8751
9620
|
},
|
|
8752
9621
|
{
|
|
8753
|
-
// --- Tracking ---
|
|
8754
9622
|
key: "initializeTracking",
|
|
8755
9623
|
value: function initializeTracking() {
|
|
8756
9624
|
var _this = this;
|
|
@@ -8842,7 +9710,6 @@ var AdTimingService = /*#__PURE__*/ function() {
|
|
|
8842
9710
|
}
|
|
8843
9711
|
},
|
|
8844
9712
|
{
|
|
8845
|
-
// --- Ad stop timer ---
|
|
8846
9713
|
key: "scheduleAdStopCountdown",
|
|
8847
9714
|
value: function scheduleAdStopCountdown(remainingMs) {
|
|
8848
9715
|
var _this = this;
|
|
@@ -8874,7 +9741,6 @@ var AdTimingService = /*#__PURE__*/ function() {
|
|
|
8874
9741
|
}
|
|
8875
9742
|
},
|
|
8876
9743
|
{
|
|
8877
|
-
// --- Ad start timer ---
|
|
8878
9744
|
key: "scheduleAdStartIn",
|
|
8879
9745
|
value: function scheduleAdStartIn(delayMs) {
|
|
8880
9746
|
var _this = this;
|
|
@@ -8902,7 +9768,6 @@ var AdTimingService = /*#__PURE__*/ function() {
|
|
|
8902
9768
|
}
|
|
8903
9769
|
},
|
|
8904
9770
|
{
|
|
8905
|
-
// --- PTS drift ---
|
|
8906
9771
|
key: "updatePtsDrift",
|
|
8907
9772
|
value: function updatePtsDrift(ptsSecondsSample) {
|
|
8908
9773
|
var sampleMs = (this.video.currentTime - ptsSecondsSample) * 1e3;
|
|
@@ -8928,7 +9793,6 @@ var AdTimingService = /*#__PURE__*/ function() {
|
|
|
8928
9793
|
}
|
|
8929
9794
|
},
|
|
8930
9795
|
{
|
|
8931
|
-
// --- Duration boundary ---
|
|
8932
9796
|
key: "beginBreakTiming",
|
|
8933
9797
|
value: function beginBreakTiming(startWallClockMs) {
|
|
8934
9798
|
this.currentAdBreakStartWallClockMs = startWallClockMs;
|
|
@@ -8976,7 +9840,6 @@ var AdTimingService = /*#__PURE__*/ function() {
|
|
|
8976
9840
|
}
|
|
8977
9841
|
},
|
|
8978
9842
|
{
|
|
8979
|
-
// --- Duration budget ---
|
|
8980
9843
|
key: "getWallClockRemainingAdMs",
|
|
8981
9844
|
value: function getWallClockRemainingAdMs() {
|
|
8982
9845
|
var endWallClockMs = this.getAdBreakEndWallClockMs();
|
|
@@ -9125,7 +9988,6 @@ var AdTimingService = /*#__PURE__*/ function() {
|
|
|
9125
9988
|
}
|
|
9126
9989
|
},
|
|
9127
9990
|
{
|
|
9128
|
-
// --- Circuit breaker ---
|
|
9129
9991
|
key: "isTemporaryAdError",
|
|
9130
9992
|
value: function isTemporaryAdError(error) {
|
|
9131
9993
|
var _error_message;
|
|
@@ -9259,7 +10121,6 @@ var AdTimingService = /*#__PURE__*/ function() {
|
|
|
9259
10121
|
}
|
|
9260
10122
|
},
|
|
9261
10123
|
{
|
|
9262
|
-
// --- Watchdog ---
|
|
9263
10124
|
key: "startAdRequestWatchdog",
|
|
9264
10125
|
value: function startAdRequestWatchdog(token) {
|
|
9265
10126
|
var _this = this;
|
|
@@ -9304,7 +10165,6 @@ var AdTimingService = /*#__PURE__*/ function() {
|
|
|
9304
10165
|
}
|
|
9305
10166
|
},
|
|
9306
10167
|
{
|
|
9307
|
-
// --- Failsafe ---
|
|
9308
10168
|
key: "startAdFailsafeTimer",
|
|
9309
10169
|
value: function startAdFailsafeTimer(token) {
|
|
9310
10170
|
var _this = this;
|
|
@@ -9366,7 +10226,6 @@ var AdTimingService = /*#__PURE__*/ function() {
|
|
|
9366
10226
|
}
|
|
9367
10227
|
},
|
|
9368
10228
|
{
|
|
9369
|
-
// --- Reset for ad break end ---
|
|
9370
10229
|
key: "resetForBreakEnd",
|
|
9371
10230
|
value: function resetForBreakEnd() {
|
|
9372
10231
|
this.clearAdStopTimer();
|
|
@@ -9565,7 +10424,7 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
9565
10424
|
adBehavior: adBehavior
|
|
9566
10425
|
});
|
|
9567
10426
|
}
|
|
9568
|
-
if (!this.config.autoplay) return [
|
|
10427
|
+
if (!(this.config.autoplay && !this.callbacks.shouldHoldContentForAds())) return [
|
|
9569
10428
|
3,
|
|
9570
10429
|
2
|
|
9571
10430
|
];
|
|
@@ -9756,6 +10615,12 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
9756
10615
|
2
|
|
9757
10616
|
];
|
|
9758
10617
|
this.hasInitialBufferCompleted = true;
|
|
10618
|
+
if (this.shouldAutoplayAfterBuffering && this.callbacks.shouldHoldContentForAds()) {
|
|
10619
|
+
this.shouldAutoplayAfterBuffering = false;
|
|
10620
|
+
if (this.debug) {
|
|
10621
|
+
console.log("[StormcloudVideoPlayer] Buffer ready during an ad break; content stays paused until the break ends");
|
|
10622
|
+
}
|
|
10623
|
+
}
|
|
9759
10624
|
if (!this.shouldAutoplayAfterBuffering) return [
|
|
9760
10625
|
3,
|
|
9761
10626
|
2
|
|
@@ -10413,9 +11278,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
10413
11278
|
}
|
|
10414
11279
|
},
|
|
10415
11280
|
{
|
|
10416
|
-
// ───────────────────────────────────────────────────────────────
|
|
10417
|
-
// IMA event listeners
|
|
10418
|
-
// ───────────────────────────────────────────────────────────────
|
|
10419
11281
|
key: "nextAdRequestUrl",
|
|
10420
11282
|
value: function nextAdRequestUrl(baseVastUrl) {
|
|
10421
11283
|
return this.host.generatePodVastUrl(baseVastUrl);
|
|
@@ -10651,9 +11513,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
10651
11513
|
}
|
|
10652
11514
|
},
|
|
10653
11515
|
{
|
|
10654
|
-
// ───────────────────────────────────────────────────────────────
|
|
10655
|
-
// Ad break start
|
|
10656
|
-
// ───────────────────────────────────────────────────────────────
|
|
10657
11516
|
key: "isBreakActive",
|
|
10658
11517
|
value: function isBreakActive() {
|
|
10659
11518
|
return this.slotState !== "IDLE";
|
|
@@ -10681,7 +11540,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
10681
11540
|
key: "handleAdStart",
|
|
10682
11541
|
value: function handleAdStart(marker) {
|
|
10683
11542
|
return _async_to_generator(function() {
|
|
10684
|
-
var baseVastUrl, edgeConfigured, adBreakDurationMs, currentMuted, currentVolume, epoch, mode, edgeUrl, outcome, podPlayed;
|
|
11543
|
+
var screenInactiveReason, baseVastUrl, edgeConfigured, adBreakDurationMs, currentMuted, currentVolume, epoch, mode, edgeUrl, outcome, podPlayed;
|
|
10685
11544
|
return _ts_generator(this, function(_state) {
|
|
10686
11545
|
switch(_state.label){
|
|
10687
11546
|
case 0:
|
|
@@ -10694,6 +11553,16 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
10694
11553
|
2
|
|
10695
11554
|
];
|
|
10696
11555
|
}
|
|
11556
|
+
screenInactiveReason = getScreenInactiveReason();
|
|
11557
|
+
if (screenInactiveReason) {
|
|
11558
|
+
this.logOrchestratorFunnel("break_skipped_screen_inactive", {
|
|
11559
|
+
reason: screenInactiveReason
|
|
11560
|
+
});
|
|
11561
|
+
this.clearPendingAdBreak();
|
|
11562
|
+
return [
|
|
11563
|
+
2
|
|
11564
|
+
];
|
|
11565
|
+
}
|
|
10697
11566
|
baseVastUrl = this.adConfig.apiVastTagUrl;
|
|
10698
11567
|
edgeConfigured = !!this.host.getEdgePodBaseUrl();
|
|
10699
11568
|
if (!baseVastUrl && !edgeConfigured) {
|
|
@@ -10854,12 +11723,9 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
10854
11723
|
},
|
|
10855
11724
|
{
|
|
10856
11725
|
key: "startOptimizedPod",
|
|
10857
|
-
value:
|
|
10858
|
-
// Optimized pod (single multi-ad request)
|
|
10859
|
-
// ───────────────────────────────────────────────────────────────
|
|
10860
|
-
function startOptimizedPod(baseVastUrl) {
|
|
11726
|
+
value: function startOptimizedPod(baseVastUrl) {
|
|
10861
11727
|
return _async_to_generator(function() {
|
|
10862
|
-
var podUrl, prefetched, epoch, generation, adPlayer, requestToken, requestUrl, _ref, _this_currentVastUrl, _adPlayer_getPodAdCount, finalizeRequestUrl, podCount, error;
|
|
11728
|
+
var podUrl, prefetched, epoch, generation, adPlayer, requestToken, requestUrl, _ref, _this_currentVastUrl, _adPlayer_getPodAdCount, finalizeRequestUrl, podCount, _this_host_config_maxAdBreakExtensionMs, remainingMs, overrunAllowanceMs, maxAdsCap, maxAds, error;
|
|
10863
11729
|
return _ts_generator(this, function(_state) {
|
|
10864
11730
|
switch(_state.label){
|
|
10865
11731
|
case 0:
|
|
@@ -10967,6 +11833,26 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
10967
11833
|
false
|
|
10968
11834
|
];
|
|
10969
11835
|
}
|
|
11836
|
+
if (this.isBreakTimeBounded() && adPlayer.limitPodToBudget) {
|
|
11837
|
+
;
|
|
11838
|
+
remainingMs = this.timing.getRemainingAdMs();
|
|
11839
|
+
overrunAllowanceMs = Math.max(0, (_this_host_config_maxAdBreakExtensionMs = this.host.config.maxAdBreakExtensionMs) !== null && _this_host_config_maxAdBreakExtensionMs !== void 0 ? _this_host_config_maxAdBreakExtensionMs : 0);
|
|
11840
|
+
maxAdsCap = this.adConfig.resolveAdPodConfig().maxAdsPerBreak;
|
|
11841
|
+
maxAds = maxAdsCap != null ? Math.max(1, maxAdsCap - this.timing.totalAdsInBreak) : Number.MAX_SAFE_INTEGER;
|
|
11842
|
+
if (Number.isFinite(remainingMs)) {
|
|
11843
|
+
podCount = adPlayer.limitPodToBudget(remainingMs + overrunAllowanceMs, maxAds);
|
|
11844
|
+
if (podCount < 1) {
|
|
11845
|
+
if (this.timing.activeAdRequestToken === requestToken) {
|
|
11846
|
+
this.timing.activeAdRequestToken = null;
|
|
11847
|
+
}
|
|
11848
|
+
this.recordRequestFailure(new Error("No GAM ad fits the ".concat(Math.round(remainingMs), "ms left in the break")), podUrl);
|
|
11849
|
+
return [
|
|
11850
|
+
2,
|
|
11851
|
+
false
|
|
11852
|
+
];
|
|
11853
|
+
}
|
|
11854
|
+
}
|
|
11855
|
+
}
|
|
10970
11856
|
this.setSlotState("READY", "vast_ready");
|
|
10971
11857
|
if (this.debug) {
|
|
10972
11858
|
console.log(podCount === 1 ? "[POD] Response contained a single ad; playing it and enabling pod top-up" : "[POD] Optimized pod returned ".concat(podCount, " ads; playing pod in one controller"));
|
|
@@ -11036,9 +11922,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
11036
11922
|
}
|
|
11037
11923
|
},
|
|
11038
11924
|
{
|
|
11039
|
-
// ───────────────────────────────────────────────────────────────
|
|
11040
|
-
// Edge-first pods (live SCTE-35 only, GAM fallback)
|
|
11041
|
-
// ───────────────────────────────────────────────────────────────
|
|
11042
11925
|
key: "resetEdgeStateForBreak",
|
|
11043
11926
|
value: function resetEdgeStateForBreak() {
|
|
11044
11927
|
this.edgeExhaustedForBreak = false;
|
|
@@ -11256,9 +12139,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
11256
12139
|
}
|
|
11257
12140
|
},
|
|
11258
12141
|
{
|
|
11259
|
-
// ───────────────────────────────────────────────────────────────
|
|
11260
|
-
// Next-ad scheduling (single flight)
|
|
11261
|
-
// ───────────────────────────────────────────────────────────────
|
|
11262
12142
|
key: "setSlotState",
|
|
11263
12143
|
value: function setSlotState(next, reason) {
|
|
11264
12144
|
if (this.slotState === next) return;
|
|
@@ -11308,6 +12188,8 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
11308
12188
|
{
|
|
11309
12189
|
key: "getStopRequestingReason",
|
|
11310
12190
|
value: function getStopRequestingReason(remainingMs) {
|
|
12191
|
+
var screenInactiveReason = getScreenInactiveReason();
|
|
12192
|
+
if (screenInactiveReason) return "screen_inactive:".concat(screenInactiveReason);
|
|
11311
12193
|
if (this.breakSource === "vmap") {
|
|
11312
12194
|
if (this.adPodQueue.length === 0) return "vmap_queue_empty";
|
|
11313
12195
|
} else if (this.breakSource !== "scte35" || !this.followUpBaseVastUrl && !this.canRequestEdge()) {
|
|
@@ -11581,9 +12463,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
11581
12463
|
}
|
|
11582
12464
|
},
|
|
11583
12465
|
{
|
|
11584
|
-
// ───────────────────────────────────────────────────────────────
|
|
11585
|
-
// Per-request diagnostics
|
|
11586
|
-
// ───────────────────────────────────────────────────────────────
|
|
11587
12466
|
key: "recordRequestDiagnostic",
|
|
11588
12467
|
value: function recordRequestDiagnostic(payload) {
|
|
11589
12468
|
var requestId = payload.requestId;
|
|
@@ -11657,9 +12536,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
11657
12536
|
}
|
|
11658
12537
|
},
|
|
11659
12538
|
{
|
|
11660
|
-
// ───────────────────────────────────────────────────────────────
|
|
11661
|
-
// Single ad playback
|
|
11662
|
-
// ───────────────────────────────────────────────────────────────
|
|
11663
12539
|
key: "createGamDispatchFinalizer",
|
|
11664
12540
|
value: function createGamDispatchFinalizer(requestToken) {
|
|
11665
12541
|
var _this = this;
|
|
@@ -12122,9 +12998,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
12122
12998
|
}
|
|
12123
12999
|
},
|
|
12124
13000
|
{
|
|
12125
|
-
// ───────────────────────────────────────────────────────────────
|
|
12126
|
-
// Ad break completion
|
|
12127
|
-
// ───────────────────────────────────────────────────────────────
|
|
12128
13001
|
key: "logBreakFunnel",
|
|
12129
13002
|
value: function logBreakFunnel(endReason) {
|
|
12130
13003
|
var funnel = this.breakFunnel;
|
|
@@ -12770,6 +13643,8 @@ var ContentHealthWatchdog = /*#__PURE__*/ function() {
|
|
|
12770
13643
|
return ContentHealthWatchdog;
|
|
12771
13644
|
}();
|
|
12772
13645
|
// src/player/StormcloudVideoPlayer.ts
|
|
13646
|
+
var DEFAULT_PAL_NONCE_MAX_AGE_MS = 5.5 * 60 * 60 * 1e3;
|
|
13647
|
+
var PAL_NONCE_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
|
|
12773
13648
|
var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
12774
13649
|
function StormcloudVideoPlayer(config) {
|
|
12775
13650
|
var _this = this;
|
|
@@ -12780,6 +13655,19 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
12780
13655
|
var browserOverrides = getBrowserConfigOverrides();
|
|
12781
13656
|
this.config = _object_spread({}, browserOverrides, config);
|
|
12782
13657
|
this.video = config.videoElement;
|
|
13658
|
+
if (this.config.forceSingleDecoderMode != null) {
|
|
13659
|
+
setSingleDecoderOverride(this.config.forceSingleDecoderMode);
|
|
13660
|
+
}
|
|
13661
|
+
if (this.config.adDeviceId) {
|
|
13662
|
+
setHostAdIdentity({
|
|
13663
|
+
deviceId: this.config.adDeviceId,
|
|
13664
|
+
deviceIdType: this.config.adDeviceIdType,
|
|
13665
|
+
limitAdTracking: this.config.adLimitAdTracking
|
|
13666
|
+
});
|
|
13667
|
+
}
|
|
13668
|
+
if (this.config.deviceInfo) {
|
|
13669
|
+
setHostDeviceInfo(this.config.deviceInfo);
|
|
13670
|
+
}
|
|
12783
13671
|
logBrowserInfo(config.debugAdTiming);
|
|
12784
13672
|
this.floorLadder = new FloorLadderController();
|
|
12785
13673
|
this.adPlayer = this.createAdPlayer(false);
|
|
@@ -12843,6 +13731,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
12843
13731
|
},
|
|
12844
13732
|
hasPendingAdBreak: function hasPendingAdBreak() {
|
|
12845
13733
|
return _this.adBreak.pendingAdBreak !== null;
|
|
13734
|
+
},
|
|
13735
|
+
shouldHoldContentForAds: function shouldHoldContentForAds() {
|
|
13736
|
+
return !!_this.adBreak && _this.adBreak.inAdBreak && !_this.shouldContinueLiveStreamDuringAds();
|
|
12846
13737
|
}
|
|
12847
13738
|
});
|
|
12848
13739
|
this.adBreak = new AdBreakOrchestrator({
|
|
@@ -13038,10 +13929,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
13038
13929
|
},
|
|
13039
13930
|
{
|
|
13040
13931
|
key: "load",
|
|
13041
|
-
value:
|
|
13042
|
-
// Lifecycle
|
|
13043
|
-
// ───────────────────────────────────────────────────────────────
|
|
13044
|
-
function load() {
|
|
13932
|
+
value: function load() {
|
|
13045
13933
|
return _async_to_generator(function() {
|
|
13046
13934
|
var _this, error, palDescriptionUrl, continueLiveStreamDuringAds;
|
|
13047
13935
|
return _ts_generator(this, function(_state) {
|
|
@@ -13051,6 +13939,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
13051
13939
|
if (!this.attached) {
|
|
13052
13940
|
this.attach();
|
|
13053
13941
|
}
|
|
13942
|
+
primeDeviceInfo().then(function(info) {
|
|
13943
|
+
if (_this.debug) {
|
|
13944
|
+
console.log("[DEVICE-INFO]", _object_spread_props(_object_spread({}, info), {
|
|
13945
|
+
internalDeviceId: info.internalDeviceId ? "...".concat(info.internalDeviceId.slice(-4)) : void 0
|
|
13946
|
+
}));
|
|
13947
|
+
}
|
|
13948
|
+
}).catch(function() {});
|
|
13054
13949
|
_state.label = 1;
|
|
13055
13950
|
case 1:
|
|
13056
13951
|
_state.trys.push([
|
|
@@ -13085,21 +13980,30 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
13085
13980
|
fetchConsentSignals().catch(function() {
|
|
13086
13981
|
return {};
|
|
13087
13982
|
}).then(function(signals) {
|
|
13088
|
-
var _this_config_lowLatencyMode;
|
|
13983
|
+
var _this_config_palContinuousPlayback, _this_config_lowLatencyMode, _this_config_palIconsSupported, _this_config_palSupportedApiFrameworks;
|
|
13089
13984
|
_this.adConfig.consentSignals = signals;
|
|
13090
13985
|
var muted = _this.video.muted;
|
|
13091
|
-
|
|
13986
|
+
var palSessionId = _this.config.ctvAdRequest ? getOrRotateSessionId(_this.config.sessionIdMaxAgeMs) : void 0;
|
|
13987
|
+
var palOptions = _object_spread({
|
|
13092
13988
|
videoWidth: _this.video.offsetWidth || _this.video.clientWidth || 640,
|
|
13093
13989
|
videoHeight: _this.video.offsetHeight || _this.video.clientHeight || 480,
|
|
13094
13990
|
adWillAutoPlay: !!_this.config.autoplay,
|
|
13095
13991
|
adWillPlayMuted: muted,
|
|
13096
13992
|
playerVolume: muted ? 0 : _this.video.volume,
|
|
13097
|
-
continuousPlayback: (_this_config_lowLatencyMode = _this.config.lowLatencyMode) !== null && _this_config_lowLatencyMode !== void 0 ? _this_config_lowLatencyMode : false
|
|
13993
|
+
continuousPlayback: (_this_config_palContinuousPlayback = _this.config.palContinuousPlayback) !== null && _this_config_palContinuousPlayback !== void 0 ? _this_config_palContinuousPlayback : _this.config.ctvAdRequest ? true : (_this_config_lowLatencyMode = _this.config.lowLatencyMode) !== null && _this_config_lowLatencyMode !== void 0 ? _this_config_lowLatencyMode : false,
|
|
13994
|
+
iconsSupported: (_this_config_palIconsSupported = _this.config.palIconsSupported) !== null && _this_config_palIconsSupported !== void 0 ? _this_config_palIconsSupported : false,
|
|
13995
|
+
supportedApiFrameworks: (_this_config_palSupportedApiFrameworks = _this.config.palSupportedApiFrameworks) !== null && _this_config_palSupportedApiFrameworks !== void 0 ? _this_config_palSupportedApiFrameworks : ""
|
|
13098
13996
|
}, palDescriptionUrl ? {
|
|
13099
13997
|
descriptionUrl: palDescriptionUrl
|
|
13100
13998
|
} : {}, signals.storageAllowed != null ? {
|
|
13101
13999
|
allowStorage: signals.storageAllowed
|
|
13102
|
-
} : {}
|
|
14000
|
+
} : {}, palSessionId ? {
|
|
14001
|
+
sessionId: palSessionId
|
|
14002
|
+
} : {});
|
|
14003
|
+
_this.lastPalOptions = palOptions;
|
|
14004
|
+
_this.palSessionId = palSessionId;
|
|
14005
|
+
_this.startPalNonceRefresh();
|
|
14006
|
+
return _this.palNonce.generateNonce(palOptions);
|
|
13103
14007
|
}).catch(function() {});
|
|
13104
14008
|
this.adConfig.initializeTracking();
|
|
13105
14009
|
if (!this.hlsEngine.shouldUseNativeHls(function() {
|
|
@@ -13137,6 +14041,92 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
13137
14041
|
}).call(this);
|
|
13138
14042
|
}
|
|
13139
14043
|
},
|
|
14044
|
+
{
|
|
14045
|
+
key: "startPalNonceRefresh",
|
|
14046
|
+
value: function startPalNonceRefresh() {
|
|
14047
|
+
var _this = this;
|
|
14048
|
+
if (this.palRefreshTimer != null || typeof window === "undefined") return;
|
|
14049
|
+
this.palRefreshTimer = window.setInterval(function() {
|
|
14050
|
+
return _this.refreshPalNonceIfStale();
|
|
14051
|
+
}, PAL_NONCE_CHECK_INTERVAL_MS);
|
|
14052
|
+
}
|
|
14053
|
+
},
|
|
14054
|
+
{
|
|
14055
|
+
key: "refreshPalNonceIfStale",
|
|
14056
|
+
value: function refreshPalNonceIfStale() {
|
|
14057
|
+
var force = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
|
|
14058
|
+
var _this_config_palNonceMaxAgeMs;
|
|
14059
|
+
var options = this.lastPalOptions;
|
|
14060
|
+
if (!options) return;
|
|
14061
|
+
var maxAgeMs = (_this_config_palNonceMaxAgeMs = this.config.palNonceMaxAgeMs) !== null && _this_config_palNonceMaxAgeMs !== void 0 ? _this_config_palNonceMaxAgeMs : DEFAULT_PAL_NONCE_MAX_AGE_MS;
|
|
14062
|
+
var ageMs = this.palNonce.getNonceAgeMs();
|
|
14063
|
+
var sessionId = this.config.ctvAdRequest ? getOrRotateSessionId(this.config.sessionIdMaxAgeMs) : void 0;
|
|
14064
|
+
var sessionChanged = sessionId !== this.palSessionId;
|
|
14065
|
+
var stale = ageMs === void 0 || ageMs >= maxAgeMs;
|
|
14066
|
+
if (!force && !stale && !sessionChanged) return;
|
|
14067
|
+
var next = _object_spread({}, options);
|
|
14068
|
+
if (sessionId) next.sessionId = sessionId;
|
|
14069
|
+
else delete next.sessionId;
|
|
14070
|
+
this.lastPalOptions = next;
|
|
14071
|
+
this.palSessionId = sessionId;
|
|
14072
|
+
if (this.debug) {
|
|
14073
|
+
console.log("[PAL] Regenerating nonce", {
|
|
14074
|
+
force: force,
|
|
14075
|
+
stale: stale,
|
|
14076
|
+
sessionChanged: sessionChanged,
|
|
14077
|
+
ageMs: ageMs
|
|
14078
|
+
});
|
|
14079
|
+
}
|
|
14080
|
+
this.palNonce.generateNonce(next).catch(function() {});
|
|
14081
|
+
}
|
|
14082
|
+
},
|
|
14083
|
+
{
|
|
14084
|
+
key: "setAdIdentity",
|
|
14085
|
+
value: function setAdIdentity(identity) {
|
|
14086
|
+
setHostAdIdentity(identity);
|
|
14087
|
+
this.refreshPalNonceIfStale();
|
|
14088
|
+
}
|
|
14089
|
+
},
|
|
14090
|
+
{
|
|
14091
|
+
key: "resetAdIdentity",
|
|
14092
|
+
value: function resetAdIdentity1() {
|
|
14093
|
+
resetAdIdentity();
|
|
14094
|
+
this.refreshPalNonceIfStale(true);
|
|
14095
|
+
}
|
|
14096
|
+
},
|
|
14097
|
+
{
|
|
14098
|
+
key: "setContentMetadata",
|
|
14099
|
+
value: function setContentMetadata(meta) {
|
|
14100
|
+
var _this = this;
|
|
14101
|
+
var apply = function apply(key, value) {
|
|
14102
|
+
if (value === void 0) return;
|
|
14103
|
+
var clean = value === null ? void 0 : sanitizeContentValue(value);
|
|
14104
|
+
if (clean) _this.config[key] = clean;
|
|
14105
|
+
else delete _this.config[key];
|
|
14106
|
+
};
|
|
14107
|
+
apply("channelName", meta.channelName);
|
|
14108
|
+
apply("programTitle", meta.programTitle);
|
|
14109
|
+
apply("contentNetwork", meta.contentNetwork);
|
|
14110
|
+
}
|
|
14111
|
+
},
|
|
14112
|
+
{
|
|
14113
|
+
key: "setScreenStandby",
|
|
14114
|
+
value: function setScreenStandby(standby) {
|
|
14115
|
+
setHostStandby(standby);
|
|
14116
|
+
}
|
|
14117
|
+
},
|
|
14118
|
+
{
|
|
14119
|
+
key: "getDeviceInfo",
|
|
14120
|
+
value: function getDeviceInfo1() {
|
|
14121
|
+
return getDeviceInfo();
|
|
14122
|
+
}
|
|
14123
|
+
},
|
|
14124
|
+
{
|
|
14125
|
+
key: "setDeviceInfo",
|
|
14126
|
+
value: function setDeviceInfo(info) {
|
|
14127
|
+
setHostDeviceInfo(info);
|
|
14128
|
+
}
|
|
14129
|
+
},
|
|
13140
14130
|
{
|
|
13141
14131
|
key: "onManifestParsed",
|
|
13142
14132
|
value: function onManifestParsed(isLive) {
|
|
@@ -13271,9 +14261,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
13271
14261
|
}
|
|
13272
14262
|
},
|
|
13273
14263
|
{
|
|
13274
|
-
// ───────────────────────────────────────────────────────────────
|
|
13275
|
-
// SCTE-35 marker orchestration
|
|
13276
|
-
// ───────────────────────────────────────────────────────────────
|
|
13277
14264
|
key: "onScte35Marker",
|
|
13278
14265
|
value: function onScte35Marker(marker, cueKey) {
|
|
13279
14266
|
if (this.debug) {
|
|
@@ -13452,9 +14439,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
13452
14439
|
}
|
|
13453
14440
|
},
|
|
13454
14441
|
{
|
|
13455
|
-
// ───────────────────────────────────────────────────────────────
|
|
13456
|
-
// Ad prefetch
|
|
13457
|
-
// ───────────────────────────────────────────────────────────────
|
|
13458
14442
|
key: "startAdPrefetch",
|
|
13459
14443
|
value: function startAdPrefetch(marker, fragmentSn, cueKey) {
|
|
13460
14444
|
if (this.adBreak.pendingAdBreak || this.adBreak.inAdBreak) return;
|
|
@@ -13493,9 +14477,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
13493
14477
|
}
|
|
13494
14478
|
},
|
|
13495
14479
|
{
|
|
13496
|
-
// ───────────────────────────────────────────────────────────────
|
|
13497
|
-
// VMAP time-based ad breaks
|
|
13498
|
-
// ───────────────────────────────────────────────────────────────
|
|
13499
14480
|
key: "onTimeUpdate",
|
|
13500
14481
|
value: function onTimeUpdate(currentTimeSec) {
|
|
13501
14482
|
var _this = this;
|
|
@@ -13609,9 +14590,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
13609
14590
|
}
|
|
13610
14591
|
},
|
|
13611
14592
|
{
|
|
13612
|
-
// ───────────────────────────────────────────────────────────────
|
|
13613
|
-
// Public API
|
|
13614
|
-
// ───────────────────────────────────────────────────────────────
|
|
13615
14593
|
key: "getCurrentAdIndex",
|
|
13616
14594
|
value: function getCurrentAdIndex() {
|
|
13617
14595
|
return this.timing.currentAdIndex;
|
|
@@ -13730,12 +14708,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
13730
14708
|
}
|
|
13731
14709
|
},
|
|
13732
14710
|
{
|
|
13733
|
-
// ───────────────────────────────────────────────────────────────
|
|
13734
|
-
// Destroy
|
|
13735
|
-
// ───────────────────────────────────────────────────────────────
|
|
13736
14711
|
key: "destroy",
|
|
13737
14712
|
value: function destroy() {
|
|
13738
14713
|
var _this_adPlayer;
|
|
14714
|
+
if (this.palRefreshTimer != null) {
|
|
14715
|
+
clearInterval(this.palRefreshTimer);
|
|
14716
|
+
this.palRefreshTimer = void 0;
|
|
14717
|
+
}
|
|
13739
14718
|
this.contentWatchdog.stop();
|
|
13740
14719
|
this.adBreak.cancelScheduledRequest();
|
|
13741
14720
|
this.timing.destroy();
|
|
@@ -13843,7 +14822,7 @@ var CRITICAL_PROPS = [
|
|
|
13843
14822
|
var CONTROLS_HIDE_DELAY = 3e3;
|
|
13844
14823
|
var DEFAULT_PLAYER_ASPECT_RATIO = 16 / 9;
|
|
13845
14824
|
var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
|
|
13846
|
-
var src = props.src, autoplay = props.autoplay, muted = props.muted, lowLatencyMode = props.lowLatencyMode, allowNativeHls = props.allowNativeHls, isLiveStream = props.isLiveStream, driftToleranceMs = props.driftToleranceMs, immediateManifestAds = props.immediateManifestAds, debugAdTiming = props.debugAdTiming, showCustomControls = props.showCustomControls, hideLoadingIndicator = props.hideLoadingIndicator, onVolumeToggle = props.onVolumeToggle, onFullscreenToggle = props.onFullscreenToggle, onControlClick = props.onControlClick, onReady = props.onReady, wrapperClassName = props.wrapperClassName, wrapperStyle = props.wrapperStyle, className = props.className, style = props.style, controls = props.controls, playsInline = props.playsInline, preload = props.preload, poster = props.poster, children = props.children, licenseKey = props.licenseKey, vastTagUrl = props.vastTagUrl, isVmap = props.isVmap, vmapUrl = props.vmapUrl, minSegmentsBeforePlay = props.minSegmentsBeforePlay, ctvAdRequest = props.ctvAdRequest, programTitle = props.programTitle, channelName = props.channelName, contentNetwork = props.contentNetwork, minRemainingMsToStartAd = props.minRemainingMsToStartAd, minRemainingMsToRequestAd = props.minRemainingMsToRequestAd, maxNoFillsPerBreak = props.maxNoFillsPerBreak, maxAdBreakExtensionMs = props.maxAdBreakExtensionMs, restVideoAttrs = _object_without_properties(props, [
|
|
14825
|
+
var src = props.src, autoplay = props.autoplay, muted = props.muted, lowLatencyMode = props.lowLatencyMode, allowNativeHls = props.allowNativeHls, isLiveStream = props.isLiveStream, driftToleranceMs = props.driftToleranceMs, immediateManifestAds = props.immediateManifestAds, debugAdTiming = props.debugAdTiming, showCustomControls = props.showCustomControls, hideLoadingIndicator = props.hideLoadingIndicator, onVolumeToggle = props.onVolumeToggle, onFullscreenToggle = props.onFullscreenToggle, onControlClick = props.onControlClick, onReady = props.onReady, wrapperClassName = props.wrapperClassName, wrapperStyle = props.wrapperStyle, className = props.className, style = props.style, controls = props.controls, playsInline = props.playsInline, preload = props.preload, poster = props.poster, children = props.children, licenseKey = props.licenseKey, vastTagUrl = props.vastTagUrl, isVmap = props.isVmap, vmapUrl = props.vmapUrl, minSegmentsBeforePlay = props.minSegmentsBeforePlay, ctvAdRequest = props.ctvAdRequest, programTitle = props.programTitle, channelName = props.channelName, contentNetwork = props.contentNetwork, minRemainingMsToStartAd = props.minRemainingMsToStartAd, minRemainingMsToRequestAd = props.minRemainingMsToRequestAd, maxNoFillsPerBreak = props.maxNoFillsPerBreak, maxAdBreakExtensionMs = props.maxAdBreakExtensionMs, adDeviceId = props.adDeviceId, adDeviceIdType = props.adDeviceIdType, adLimitAdTracking = props.adLimitAdTracking, fallbackDeviceIdMaxAgeMs = props.fallbackDeviceIdMaxAgeMs, sessionIdMaxAgeMs = props.sessionIdMaxAgeMs, palIconsSupported = props.palIconsSupported, palSupportedApiFrameworks = props.palSupportedApiFrameworks, palContinuousPlayback = props.palContinuousPlayback, palNonceMaxAgeMs = props.palNonceMaxAgeMs, forceSingleDecoderMode = props.forceSingleDecoderMode, deviceInfo = props.deviceInfo, sendDeviceKeyValues = props.sendDeviceKeyValues, sendDeviceInfoToAnalytics = props.sendDeviceInfoToAnalytics, restVideoAttrs = _object_without_properties(props, [
|
|
13847
14826
|
"src",
|
|
13848
14827
|
"autoplay",
|
|
13849
14828
|
"muted",
|
|
@@ -13880,7 +14859,20 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
|
|
|
13880
14859
|
"minRemainingMsToStartAd",
|
|
13881
14860
|
"minRemainingMsToRequestAd",
|
|
13882
14861
|
"maxNoFillsPerBreak",
|
|
13883
|
-
"maxAdBreakExtensionMs"
|
|
14862
|
+
"maxAdBreakExtensionMs",
|
|
14863
|
+
"adDeviceId",
|
|
14864
|
+
"adDeviceIdType",
|
|
14865
|
+
"adLimitAdTracking",
|
|
14866
|
+
"fallbackDeviceIdMaxAgeMs",
|
|
14867
|
+
"sessionIdMaxAgeMs",
|
|
14868
|
+
"palIconsSupported",
|
|
14869
|
+
"palSupportedApiFrameworks",
|
|
14870
|
+
"palContinuousPlayback",
|
|
14871
|
+
"palNonceMaxAgeMs",
|
|
14872
|
+
"forceSingleDecoderMode",
|
|
14873
|
+
"deviceInfo",
|
|
14874
|
+
"sendDeviceKeyValues",
|
|
14875
|
+
"sendDeviceInfoToAnalytics"
|
|
13884
14876
|
]);
|
|
13885
14877
|
var videoRef = (0, import_react.useRef)(null);
|
|
13886
14878
|
var playerRef = (0, import_react.useRef)(null);
|
|
@@ -14076,6 +15068,19 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
|
|
|
14076
15068
|
if (minRemainingMsToRequestAd !== void 0) cfg.minRemainingMsToRequestAd = minRemainingMsToRequestAd;
|
|
14077
15069
|
if (maxNoFillsPerBreak !== void 0) cfg.maxNoFillsPerBreak = maxNoFillsPerBreak;
|
|
14078
15070
|
if (maxAdBreakExtensionMs !== void 0) cfg.maxAdBreakExtensionMs = maxAdBreakExtensionMs;
|
|
15071
|
+
if (adDeviceId !== void 0) cfg.adDeviceId = adDeviceId;
|
|
15072
|
+
if (adDeviceIdType !== void 0) cfg.adDeviceIdType = adDeviceIdType;
|
|
15073
|
+
if (adLimitAdTracking !== void 0) cfg.adLimitAdTracking = adLimitAdTracking;
|
|
15074
|
+
if (fallbackDeviceIdMaxAgeMs !== void 0) cfg.fallbackDeviceIdMaxAgeMs = fallbackDeviceIdMaxAgeMs;
|
|
15075
|
+
if (sessionIdMaxAgeMs !== void 0) cfg.sessionIdMaxAgeMs = sessionIdMaxAgeMs;
|
|
15076
|
+
if (palIconsSupported !== void 0) cfg.palIconsSupported = palIconsSupported;
|
|
15077
|
+
if (palSupportedApiFrameworks !== void 0) cfg.palSupportedApiFrameworks = palSupportedApiFrameworks;
|
|
15078
|
+
if (palContinuousPlayback !== void 0) cfg.palContinuousPlayback = palContinuousPlayback;
|
|
15079
|
+
if (palNonceMaxAgeMs !== void 0) cfg.palNonceMaxAgeMs = palNonceMaxAgeMs;
|
|
15080
|
+
if (forceSingleDecoderMode !== void 0) cfg.forceSingleDecoderMode = forceSingleDecoderMode;
|
|
15081
|
+
if (deviceInfo !== void 0) cfg.deviceInfo = deviceInfo;
|
|
15082
|
+
if (sendDeviceKeyValues !== void 0) cfg.sendDeviceKeyValues = sendDeviceKeyValues;
|
|
15083
|
+
if (sendDeviceInfoToAnalytics !== void 0) cfg.sendDeviceInfoToAnalytics = sendDeviceInfoToAnalytics;
|
|
14079
15084
|
var player = new StormcloudVideoPlayer(cfg);
|
|
14080
15085
|
playerRef.current = player;
|
|
14081
15086
|
player.load().then(function() {
|
|
@@ -14115,6 +15120,41 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
|
|
|
14115
15120
|
autoplay,
|
|
14116
15121
|
muted
|
|
14117
15122
|
]);
|
|
15123
|
+
(0, import_react.useEffect)(function() {
|
|
15124
|
+
var _playerRef_current;
|
|
15125
|
+
(_playerRef_current = playerRef.current) === null || _playerRef_current === void 0 ? void 0 : _playerRef_current.setContentMetadata({
|
|
15126
|
+
channelName: channelName !== null && channelName !== void 0 ? channelName : null,
|
|
15127
|
+
programTitle: programTitle !== null && programTitle !== void 0 ? programTitle : null,
|
|
15128
|
+
contentNetwork: contentNetwork !== null && contentNetwork !== void 0 ? contentNetwork : null
|
|
15129
|
+
});
|
|
15130
|
+
}, [
|
|
15131
|
+
channelName,
|
|
15132
|
+
programTitle,
|
|
15133
|
+
contentNetwork
|
|
15134
|
+
]);
|
|
15135
|
+
var lastAdDeviceIdRef = (0, import_react.useRef)(void 0);
|
|
15136
|
+
(0, import_react.useEffect)(function() {
|
|
15137
|
+
var player = playerRef.current;
|
|
15138
|
+
if (!player) return;
|
|
15139
|
+
if (adDeviceId === void 0 && lastAdDeviceIdRef.current === void 0) return;
|
|
15140
|
+
lastAdDeviceIdRef.current = adDeviceId;
|
|
15141
|
+
player.setAdIdentity(adDeviceId ? {
|
|
15142
|
+
deviceId: adDeviceId,
|
|
15143
|
+
deviceIdType: adDeviceIdType,
|
|
15144
|
+
limitAdTracking: adLimitAdTracking
|
|
15145
|
+
} : null);
|
|
15146
|
+
}, [
|
|
15147
|
+
adDeviceId,
|
|
15148
|
+
adDeviceIdType,
|
|
15149
|
+
adLimitAdTracking
|
|
15150
|
+
]);
|
|
15151
|
+
var deviceInfoKey = deviceInfo ? JSON.stringify(deviceInfo) : "";
|
|
15152
|
+
(0, import_react.useEffect)(function() {
|
|
15153
|
+
if (!playerRef.current || !deviceInfoKey) return;
|
|
15154
|
+
playerRef.current.setDeviceInfo(JSON.parse(deviceInfoKey));
|
|
15155
|
+
}, [
|
|
15156
|
+
deviceInfoKey
|
|
15157
|
+
]);
|
|
14118
15158
|
(0, import_react.useEffect)(function() {
|
|
14119
15159
|
if (!playerRef.current) return;
|
|
14120
15160
|
var checkAdStatus = function checkAdStatus() {
|