stormcloud-video-player 0.8.23 → 0.8.25
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 +1 -1
- package/lib/index.cjs +1187 -1109
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +3 -1
- package/lib/index.d.ts +3 -1
- package/lib/index.js +1028 -954
- package/lib/index.js.map +1 -1
- package/lib/player/AdBreakOrchestrator.cjs +419 -26
- package/lib/player/AdBreakOrchestrator.cjs.map +1 -1
- package/lib/player/AdBreakOrchestrator.d.cts +2 -1
- package/lib/player/AdConfigManager.cjs +90 -22
- package/lib/player/AdConfigManager.cjs.map +1 -1
- package/lib/player/AdConfigManager.d.cts +1 -1
- package/lib/player/AdPreloadPool.d.cts +1 -1
- package/lib/player/AdTimingService.d.cts +1 -1
- package/lib/player/HlsEngine.d.cts +1 -1
- package/lib/player/PlayerControls.d.cts +1 -1
- package/lib/player/Scte35CueManager.d.cts +1 -1
- package/lib/player/Scte35Parser.d.cts +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +1184 -1110
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +1 -1
- package/lib/player/playerTypes.d.cts +1 -1
- package/lib/players/HlsPlayer.cjs +1184 -1110
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.d.cts +1 -1
- package/lib/players/index.cjs +1184 -1110
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.d.cts +1 -1
- package/lib/{types-DNiBmPKK.d.cts → types-Bz4aRmzc.d.cts} +1 -0
- package/lib/ui/StormcloudVideoPlayer.cjs +1184 -1110
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.d.cts +1 -1
- package/lib/utils/ctvVastSignals.cjs.map +1 -1
- package/lib/utils/tracking.cjs +411 -20
- package/lib/utils/tracking.cjs.map +1 -1
- package/lib/utils/tracking.d.cts +3 -2
- package/lib/utils/vastEnvironmentSignals.cjs +37 -0
- package/lib/utils/vastEnvironmentSignals.cjs.map +1 -1
- package/lib/utils/vastEnvironmentSignals.d.cts +4 -1
- package/lib/utils/vastMacros.cjs.map +1 -1
- package/package.json +1 -1
|
@@ -376,8 +376,362 @@ function publishMQTT(topic, payload) {
|
|
|
376
376
|
return false;
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
|
+
// src/utils/vastEnvironmentSignals.ts
|
|
380
|
+
var PLAYER_ID_STORAGE_KEY = "stormcloud.player.id";
|
|
381
|
+
var DEVICE_ID_STORAGE_KEYS = [
|
|
382
|
+
"rdid",
|
|
383
|
+
"ifa",
|
|
384
|
+
"advertisingId",
|
|
385
|
+
"advertising_id",
|
|
386
|
+
"deviceAdvertisingId",
|
|
387
|
+
"aaid",
|
|
388
|
+
"adid",
|
|
389
|
+
"rida",
|
|
390
|
+
"tifa",
|
|
391
|
+
"lgudid"
|
|
392
|
+
];
|
|
393
|
+
function inferDeviceIdType() {
|
|
394
|
+
if (typeof navigator === "undefined") {
|
|
395
|
+
return void 0;
|
|
396
|
+
}
|
|
397
|
+
var ua = navigator.userAgent;
|
|
398
|
+
if (/Roku/i.test(ua)) return "rida";
|
|
399
|
+
if (/Tizen|Samsung/i.test(ua)) return "tifa";
|
|
400
|
+
if (/AppleTV|Apple TV/i.test(ua)) return "tvOS";
|
|
401
|
+
if (/AFT|Fire TV|Amazon/i.test(ua)) return "afai";
|
|
402
|
+
if (/Web0S|webOS|LG Browser|LGSTB|LGE/i.test(ua)) return "lgudid";
|
|
403
|
+
if (/Android|Google TV/i.test(ua)) return "aaid";
|
|
404
|
+
if (/iPhone|iPad|iPod/i.test(ua)) return "idfa";
|
|
405
|
+
return void 0;
|
|
406
|
+
}
|
|
407
|
+
function resolveNativeDeviceId() {
|
|
408
|
+
var bridgeSignals = readNativeBridgeSignals();
|
|
409
|
+
var platformDevice = readPlatformNativeDeviceId();
|
|
410
|
+
var deviceId = bridgeSignals.deviceId || readStoredDeviceId() || platformDevice.deviceId;
|
|
411
|
+
if (!deviceId || isMacroPlaceholder(deviceId) || isZeroedAdId(deviceId)) {
|
|
412
|
+
return void 0;
|
|
413
|
+
}
|
|
414
|
+
return deviceId;
|
|
415
|
+
}
|
|
416
|
+
function getOrCreateStoredUuid(storageKey) {
|
|
417
|
+
if (typeof window === "undefined") {
|
|
418
|
+
return void 0;
|
|
419
|
+
}
|
|
420
|
+
var existing = readStoredString(storageKey);
|
|
421
|
+
if (existing) {
|
|
422
|
+
return existing;
|
|
423
|
+
}
|
|
424
|
+
var id = createUuid();
|
|
425
|
+
try {
|
|
426
|
+
var _window_localStorage;
|
|
427
|
+
(_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(storageKey, id);
|
|
428
|
+
} catch (unused) {}
|
|
429
|
+
return id;
|
|
430
|
+
}
|
|
431
|
+
function createUuid() {
|
|
432
|
+
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
433
|
+
return crypto.randomUUID();
|
|
434
|
+
}
|
|
435
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(char) {
|
|
436
|
+
var value = Math.floor(Math.random() * 16);
|
|
437
|
+
var nibble = char === "x" ? value : value & 3 | 8;
|
|
438
|
+
return nibble.toString(16);
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
function readPlatformNativeDeviceId() {
|
|
442
|
+
if (typeof window === "undefined") return {};
|
|
443
|
+
try {
|
|
444
|
+
var _window_webapis;
|
|
445
|
+
var adinfo = (_window_webapis = window.webapis) === null || _window_webapis === void 0 ? void 0 : _window_webapis.adinfo;
|
|
446
|
+
if (adinfo) {
|
|
447
|
+
var tifa = typeof adinfo.getTIFA === "function" ? adinfo.getTIFA() : adinfo.tifa;
|
|
448
|
+
if (typeof tifa === "string" && tifa && !isMacroPlaceholder(tifa)) {
|
|
449
|
+
var lat = typeof adinfo.isLATEnabled === "function" ? adinfo.isLATEnabled() : void 0;
|
|
450
|
+
return _object_spread({
|
|
451
|
+
deviceId: tifa,
|
|
452
|
+
deviceIdType: "tifa"
|
|
453
|
+
}, typeof lat === "boolean" ? {
|
|
454
|
+
limitAdTracking: lat
|
|
455
|
+
} : {});
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
} catch (unused) {}
|
|
459
|
+
try {
|
|
460
|
+
var webOSDev = window.webOSDev;
|
|
461
|
+
if (webOSDev) {
|
|
462
|
+
var _webOSDev_lgudid;
|
|
463
|
+
var lgudid = typeof webOSDev.LGUDID === "function" ? webOSDev.LGUDID() : (_webOSDev_lgudid = webOSDev.lgudid) !== null && _webOSDev_lgudid !== void 0 ? _webOSDev_lgudid : webOSDev.LGUDID;
|
|
464
|
+
if (typeof lgudid === "string" && lgudid) {
|
|
465
|
+
if (isZeroedAdId(lgudid)) {
|
|
466
|
+
return {
|
|
467
|
+
deviceIdType: "lgudid",
|
|
468
|
+
limitAdTracking: true
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
if (!isMacroPlaceholder(lgudid)) {
|
|
472
|
+
return {
|
|
473
|
+
deviceId: lgudid,
|
|
474
|
+
deviceIdType: "lgudid",
|
|
475
|
+
limitAdTracking: false
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
} catch (unused) {}
|
|
481
|
+
try {
|
|
482
|
+
var roku = window.Roku;
|
|
483
|
+
if (roku) {
|
|
484
|
+
var rida = typeof roku.getPublisherUniqueId === "function" ? roku.getPublisherUniqueId() : roku.rida;
|
|
485
|
+
if (typeof rida === "string" && rida && !isMacroPlaceholder(rida)) {
|
|
486
|
+
return {
|
|
487
|
+
deviceId: rida,
|
|
488
|
+
deviceIdType: "rida",
|
|
489
|
+
limitAdTracking: false
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
} catch (unused) {}
|
|
494
|
+
return {};
|
|
495
|
+
}
|
|
496
|
+
var ZEROED_AD_ID_PATTERNS = /* @__PURE__ */ new Set([
|
|
497
|
+
"38400000-8cf0-11bd-b23e-10b96e40000d",
|
|
498
|
+
"00000000-0000-0000-0000-000000000000"
|
|
499
|
+
]);
|
|
500
|
+
function isMacroPlaceholder(value) {
|
|
501
|
+
var t = value.trim();
|
|
502
|
+
return !t || /^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%)$/.test(t) || /^(unknown|null|undefined|none|n\/a|\$\{[^}]+\})$/i.test(t) || ZEROED_AD_ID_PATTERNS.has(t.toLowerCase());
|
|
503
|
+
}
|
|
504
|
+
function isZeroedAdId(value) {
|
|
505
|
+
return ZEROED_AD_ID_PATTERNS.has(value.trim().toLowerCase());
|
|
506
|
+
}
|
|
507
|
+
function readNativeBridgeSignals() {
|
|
508
|
+
if (typeof window === "undefined") {
|
|
509
|
+
return {};
|
|
510
|
+
}
|
|
511
|
+
var candidates = [
|
|
512
|
+
window.__STORMCLOUD_CTV_AD_INFO__,
|
|
513
|
+
window.__STORMCLOUD_CTV__,
|
|
514
|
+
window.stormcloudCtv,
|
|
515
|
+
window.AiryTV,
|
|
516
|
+
window.Android,
|
|
517
|
+
window.webOS,
|
|
518
|
+
window.tizen,
|
|
519
|
+
window.amazon
|
|
520
|
+
].filter(Boolean);
|
|
521
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
522
|
+
try {
|
|
523
|
+
for(var _iterator = candidates[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
524
|
+
var source = _step.value;
|
|
525
|
+
var contentUrl = readBridgeValue(source, [
|
|
526
|
+
"contentUrl",
|
|
527
|
+
"url",
|
|
528
|
+
"videoUrl",
|
|
529
|
+
"canonicalUrl"
|
|
530
|
+
]) || void 0;
|
|
531
|
+
var appId = readBridgeValue(source, [
|
|
532
|
+
"appId",
|
|
533
|
+
"msid",
|
|
534
|
+
"applicationId",
|
|
535
|
+
"packageName"
|
|
536
|
+
]) || void 0;
|
|
537
|
+
var appName = readBridgeValue(source, [
|
|
538
|
+
"appName",
|
|
539
|
+
"an",
|
|
540
|
+
"applicationName"
|
|
541
|
+
]) || void 0;
|
|
542
|
+
var deviceId = readBridgeValue(source, [
|
|
543
|
+
"rdid",
|
|
544
|
+
"ifa",
|
|
545
|
+
"advertisingId",
|
|
546
|
+
"adId",
|
|
547
|
+
"deviceId",
|
|
548
|
+
"lgudid",
|
|
549
|
+
"LGUDID",
|
|
550
|
+
"tifa",
|
|
551
|
+
"rida",
|
|
552
|
+
"afai",
|
|
553
|
+
"aaid"
|
|
554
|
+
]) || void 0;
|
|
555
|
+
if (!contentUrl && !deviceId && !appId && !appName) continue;
|
|
556
|
+
var deviceIdType = readBridgeValue(source, [
|
|
557
|
+
"idtype",
|
|
558
|
+
"deviceIdType",
|
|
559
|
+
"advertisingIdType",
|
|
560
|
+
"idType"
|
|
561
|
+
]) || inferDeviceIdType();
|
|
562
|
+
var limitAdTracking = readBridgeBoolean(source, [
|
|
563
|
+
"is_lat",
|
|
564
|
+
"limitAdTracking",
|
|
565
|
+
"limitedAdTracking",
|
|
566
|
+
"lat"
|
|
567
|
+
]);
|
|
568
|
+
return _object_spread({}, contentUrl ? {
|
|
569
|
+
contentUrl: contentUrl
|
|
570
|
+
} : {}, appId ? {
|
|
571
|
+
appId: appId
|
|
572
|
+
} : {}, appName ? {
|
|
573
|
+
appName: appName
|
|
574
|
+
} : {}, deviceId ? {
|
|
575
|
+
deviceId: deviceId
|
|
576
|
+
} : {}, deviceId && deviceIdType ? {
|
|
577
|
+
deviceIdType: deviceIdType
|
|
578
|
+
} : {}, deviceId && limitAdTracking != null ? {
|
|
579
|
+
limitAdTracking: limitAdTracking
|
|
580
|
+
} : {});
|
|
581
|
+
}
|
|
582
|
+
} catch (err) {
|
|
583
|
+
_didIteratorError = true;
|
|
584
|
+
_iteratorError = err;
|
|
585
|
+
} finally{
|
|
586
|
+
try {
|
|
587
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
588
|
+
_iterator.return();
|
|
589
|
+
}
|
|
590
|
+
} finally{
|
|
591
|
+
if (_didIteratorError) {
|
|
592
|
+
throw _iteratorError;
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
return {};
|
|
597
|
+
}
|
|
598
|
+
function readBridgeValue(source, keys) {
|
|
599
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
600
|
+
try {
|
|
601
|
+
for(var _iterator = keys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
602
|
+
var key = _step.value;
|
|
603
|
+
var value = source === null || source === void 0 ? void 0 : source[key];
|
|
604
|
+
if (typeof value === "string" && value) {
|
|
605
|
+
return value;
|
|
606
|
+
}
|
|
607
|
+
if (typeof value === "function") {
|
|
608
|
+
try {
|
|
609
|
+
var result = value.call(source);
|
|
610
|
+
if (typeof result === "string" && result) {
|
|
611
|
+
return result;
|
|
612
|
+
}
|
|
613
|
+
} catch (unused) {}
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
} catch (err) {
|
|
617
|
+
_didIteratorError = true;
|
|
618
|
+
_iteratorError = err;
|
|
619
|
+
} finally{
|
|
620
|
+
try {
|
|
621
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
622
|
+
_iterator.return();
|
|
623
|
+
}
|
|
624
|
+
} finally{
|
|
625
|
+
if (_didIteratorError) {
|
|
626
|
+
throw _iteratorError;
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
return void 0;
|
|
631
|
+
}
|
|
632
|
+
function readBridgeBoolean(source, keys) {
|
|
633
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
634
|
+
try {
|
|
635
|
+
for(var _iterator = keys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
636
|
+
var key = _step.value;
|
|
637
|
+
var value = source === null || source === void 0 ? void 0 : source[key];
|
|
638
|
+
var normalized = normalizeBoolean(value);
|
|
639
|
+
if (normalized != null) {
|
|
640
|
+
return normalized;
|
|
641
|
+
}
|
|
642
|
+
if (typeof value === "function") {
|
|
643
|
+
try {
|
|
644
|
+
var result = normalizeBoolean(value.call(source));
|
|
645
|
+
if (result != null) {
|
|
646
|
+
return result;
|
|
647
|
+
}
|
|
648
|
+
} catch (unused) {}
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
} catch (err) {
|
|
652
|
+
_didIteratorError = true;
|
|
653
|
+
_iteratorError = err;
|
|
654
|
+
} finally{
|
|
655
|
+
try {
|
|
656
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
657
|
+
_iterator.return();
|
|
658
|
+
}
|
|
659
|
+
} finally{
|
|
660
|
+
if (_didIteratorError) {
|
|
661
|
+
throw _iteratorError;
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
return void 0;
|
|
666
|
+
}
|
|
667
|
+
function readStoredDeviceId() {
|
|
668
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
669
|
+
try {
|
|
670
|
+
for(var _iterator = DEVICE_ID_STORAGE_KEYS[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
671
|
+
var key = _step.value;
|
|
672
|
+
var value = readStoredString(key);
|
|
673
|
+
if (value) {
|
|
674
|
+
return value;
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
} catch (err) {
|
|
678
|
+
_didIteratorError = true;
|
|
679
|
+
_iteratorError = err;
|
|
680
|
+
} finally{
|
|
681
|
+
try {
|
|
682
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
683
|
+
_iterator.return();
|
|
684
|
+
}
|
|
685
|
+
} finally{
|
|
686
|
+
if (_didIteratorError) {
|
|
687
|
+
throw _iteratorError;
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
return void 0;
|
|
692
|
+
}
|
|
693
|
+
function readStoredString(key) {
|
|
694
|
+
if (typeof window === "undefined") {
|
|
695
|
+
return void 0;
|
|
696
|
+
}
|
|
697
|
+
try {
|
|
698
|
+
var _window_localStorage;
|
|
699
|
+
var value = (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.getItem(key);
|
|
700
|
+
return value || void 0;
|
|
701
|
+
} catch (unused) {
|
|
702
|
+
return void 0;
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
function normalizeBoolean(value) {
|
|
706
|
+
if (typeof value === "boolean") {
|
|
707
|
+
return value;
|
|
708
|
+
}
|
|
709
|
+
if (typeof value === "number") {
|
|
710
|
+
return value === 1;
|
|
711
|
+
}
|
|
712
|
+
if (typeof value === "string") {
|
|
713
|
+
var normalized = value.toLowerCase();
|
|
714
|
+
if (normalized === "1" || normalized === "true" || normalized === "yes") {
|
|
715
|
+
return true;
|
|
716
|
+
}
|
|
717
|
+
if (normalized === "0" || normalized === "false" || normalized === "no") {
|
|
718
|
+
return false;
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
return void 0;
|
|
722
|
+
}
|
|
379
723
|
// src/utils/tracking.ts
|
|
380
724
|
var cachedBrowserId = null;
|
|
725
|
+
function buildAnalyticsContext(config) {
|
|
726
|
+
var context = {};
|
|
727
|
+
if (config.debugAdTiming) {
|
|
728
|
+
context.debugAdTiming = true;
|
|
729
|
+
}
|
|
730
|
+
if (config.isLiveStream !== void 0) {
|
|
731
|
+
context.inputStreamType = config.isLiveStream ? "live" : "vod";
|
|
732
|
+
}
|
|
733
|
+
return context;
|
|
734
|
+
}
|
|
381
735
|
function getClientInfo() {
|
|
382
736
|
var _screen, _screen1, _screen2, _screen3, _screen_orientation, _screen4, _screen5, _window, _window1, _window_screen_orientation, _window_screen, _navigator_languages;
|
|
383
737
|
var ua = navigator.userAgent;
|
|
@@ -520,19 +874,12 @@ function getClientInfo() {
|
|
|
520
874
|
visibilityState: document.visibilityState
|
|
521
875
|
};
|
|
522
876
|
}
|
|
523
|
-
function
|
|
877
|
+
function sha256Hex(input) {
|
|
524
878
|
return _async_to_generator(function() {
|
|
525
|
-
var _crypto_subtle,
|
|
879
|
+
var _crypto_subtle, encodedData, utf8, buffer, i, hashBuffer, unused, hash, i1, char, fallbackHash, timestamp, random;
|
|
526
880
|
return _ts_generator(this, function(_state) {
|
|
527
881
|
switch(_state.label){
|
|
528
882
|
case 0:
|
|
529
|
-
if (cachedBrowserId) {
|
|
530
|
-
return [
|
|
531
|
-
2,
|
|
532
|
-
cachedBrowserId
|
|
533
|
-
];
|
|
534
|
-
}
|
|
535
|
-
fingerprintString = JSON.stringify(clientInfo);
|
|
536
883
|
if (!(typeof crypto !== "undefined" && ((_crypto_subtle = crypto.subtle) === null || _crypto_subtle === void 0 ? void 0 : _crypto_subtle.digest))) return [
|
|
537
884
|
3,
|
|
538
885
|
5
|
|
@@ -556,9 +903,9 @@ function getBrowserID(clientInfo) {
|
|
|
556
903
|
case 2:
|
|
557
904
|
_state.sent();
|
|
558
905
|
if (typeof TextEncoder !== "undefined") {
|
|
559
|
-
encodedData = new TextEncoder().encode(
|
|
906
|
+
encodedData = new TextEncoder().encode(input);
|
|
560
907
|
} else {
|
|
561
|
-
utf8 = unescape(encodeURIComponent(
|
|
908
|
+
utf8 = unescape(encodeURIComponent(input));
|
|
562
909
|
buffer = new Uint8Array(utf8.length);
|
|
563
910
|
for(i = 0; i < utf8.length; i++){
|
|
564
911
|
buffer[i] = utf8.charCodeAt(i);
|
|
@@ -571,13 +918,11 @@ function getBrowserID(clientInfo) {
|
|
|
571
918
|
];
|
|
572
919
|
case 3:
|
|
573
920
|
hashBuffer = _state.sent();
|
|
574
|
-
hashHex = Array.from(new Uint8Array(hashBuffer)).map(function(b) {
|
|
575
|
-
return b.toString(16).padStart(2, "0");
|
|
576
|
-
}).join("");
|
|
577
|
-
cachedBrowserId = hashHex;
|
|
578
921
|
return [
|
|
579
922
|
2,
|
|
580
|
-
|
|
923
|
+
Array.from(new Uint8Array(hashBuffer)).map(function(b) {
|
|
924
|
+
return b.toString(16).padStart(2, "0");
|
|
925
|
+
}).join("")
|
|
581
926
|
];
|
|
582
927
|
case 4:
|
|
583
928
|
unused = _state.sent();
|
|
@@ -588,15 +933,50 @@ function getBrowserID(clientInfo) {
|
|
|
588
933
|
];
|
|
589
934
|
case 5:
|
|
590
935
|
hash = 0;
|
|
591
|
-
for(i1 = 0; i1 <
|
|
592
|
-
char =
|
|
936
|
+
for(i1 = 0; i1 < input.length; i1++){
|
|
937
|
+
char = input.charCodeAt(i1);
|
|
593
938
|
hash = (hash << 5) - hash + char;
|
|
594
939
|
hash = hash & hash;
|
|
595
940
|
}
|
|
596
941
|
fallbackHash = Math.abs(hash).toString(16).padStart(8, "0");
|
|
597
942
|
timestamp = Date.now().toString(16).padStart(12, "0");
|
|
598
943
|
random = Math.random().toString(16).substring(2, 14).padStart(12, "0");
|
|
599
|
-
|
|
944
|
+
return [
|
|
945
|
+
2,
|
|
946
|
+
(fallbackHash + timestamp + random).padEnd(64, "0")
|
|
947
|
+
];
|
|
948
|
+
}
|
|
949
|
+
});
|
|
950
|
+
})();
|
|
951
|
+
}
|
|
952
|
+
function resolvePlayerIdentitySeed(clientInfo) {
|
|
953
|
+
var nativeDeviceId = resolveNativeDeviceId();
|
|
954
|
+
if (nativeDeviceId) {
|
|
955
|
+
return "device:".concat(nativeDeviceId);
|
|
956
|
+
}
|
|
957
|
+
var persistedId = getOrCreateStoredUuid(PLAYER_ID_STORAGE_KEY);
|
|
958
|
+
if (persistedId) {
|
|
959
|
+
return "persisted:".concat(persistedId);
|
|
960
|
+
}
|
|
961
|
+
return "fingerprint:".concat(JSON.stringify(clientInfo));
|
|
962
|
+
}
|
|
963
|
+
function getBrowserID(clientInfo) {
|
|
964
|
+
return _async_to_generator(function() {
|
|
965
|
+
return _ts_generator(this, function(_state) {
|
|
966
|
+
switch(_state.label){
|
|
967
|
+
case 0:
|
|
968
|
+
if (cachedBrowserId) {
|
|
969
|
+
return [
|
|
970
|
+
2,
|
|
971
|
+
cachedBrowserId
|
|
972
|
+
];
|
|
973
|
+
}
|
|
974
|
+
return [
|
|
975
|
+
4,
|
|
976
|
+
sha256Hex(resolvePlayerIdentitySeed(clientInfo))
|
|
977
|
+
];
|
|
978
|
+
case 1:
|
|
979
|
+
cachedBrowserId = _state.sent();
|
|
600
980
|
return [
|
|
601
981
|
2,
|
|
602
982
|
cachedBrowserId
|
|
@@ -610,19 +990,26 @@ function canPublish(licenseKey) {
|
|
|
610
990
|
}
|
|
611
991
|
function buildPlayerMetricEvent() {
|
|
612
992
|
return _async_to_generator(function() {
|
|
613
|
-
var context, flags, _flags_captureAt, _flags_adLoaded, _flags_adDetect, clientInfo, playerId, captureAt;
|
|
993
|
+
var context, flags, _flags_captureAt, _flags_adLoaded, _flags_adDetect, clientInfo, debugAdTiming, playerId, captureAt;
|
|
614
994
|
var _arguments = arguments;
|
|
615
995
|
return _ts_generator(this, function(_state) {
|
|
616
996
|
switch(_state.label){
|
|
617
997
|
case 0:
|
|
618
998
|
context = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {}, flags = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : {};
|
|
619
999
|
clientInfo = getClientInfo();
|
|
1000
|
+
debugAdTiming = !!context.debugAdTiming;
|
|
1001
|
+
if (debugAdTiming) {
|
|
1002
|
+
console.log("[StormcloudVideoPlayer] clientInfo: ", JSON.stringify(clientInfo, null, 2));
|
|
1003
|
+
}
|
|
620
1004
|
return [
|
|
621
1005
|
4,
|
|
622
1006
|
getBrowserID(clientInfo)
|
|
623
1007
|
];
|
|
624
1008
|
case 1:
|
|
625
1009
|
playerId = _state.sent();
|
|
1010
|
+
if (debugAdTiming) {
|
|
1011
|
+
console.log("[StormcloudVideoPlayer] playerId: ", playerId);
|
|
1012
|
+
}
|
|
626
1013
|
captureAt = (_flags_captureAt = flags.captureAt) !== null && _flags_captureAt !== void 0 ? _flags_captureAt : /* @__PURE__ */ new Date().toISOString();
|
|
627
1014
|
return [
|
|
628
1015
|
2,
|
|
@@ -823,6 +1210,12 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
823
1210
|
return !!this.host.config.debugAdTiming;
|
|
824
1211
|
}
|
|
825
1212
|
},
|
|
1213
|
+
{
|
|
1214
|
+
key: "analyticsContext",
|
|
1215
|
+
get: function get() {
|
|
1216
|
+
return buildAnalyticsContext(this.host.config);
|
|
1217
|
+
}
|
|
1218
|
+
},
|
|
826
1219
|
{
|
|
827
1220
|
// ───────────────────────────────────────────────────────────────
|
|
828
1221
|
// IMA event listeners
|
|
@@ -836,7 +1229,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
836
1229
|
source: "hls",
|
|
837
1230
|
adIndex: _this.timing.currentAdIndex,
|
|
838
1231
|
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
839
|
-
}).catch(function() {});
|
|
1232
|
+
}, _this.analyticsContext).catch(function() {});
|
|
840
1233
|
_this.timing.recordPlayedAdDuration(_this.host.getAdPlayer());
|
|
841
1234
|
var remaining = _this.timing.getRemainingAdMs();
|
|
842
1235
|
_this.timing.consecutiveFailures = 0;
|
|
@@ -898,7 +1291,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
898
1291
|
source: "hls",
|
|
899
1292
|
adIndex: _this.timing.currentAdIndex,
|
|
900
1293
|
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
901
|
-
}).catch(function() {});
|
|
1294
|
+
}, _this.analyticsContext).catch(function() {});
|
|
902
1295
|
if (!_this.host.video.muted) {
|
|
903
1296
|
_this.host.video.muted = true;
|
|
904
1297
|
if (_this.debug) {
|
|
@@ -1045,7 +1438,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1045
1438
|
source: "hls",
|
|
1046
1439
|
vastUrl: firstAdUrl,
|
|
1047
1440
|
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
1048
|
-
}).catch(function() {});
|
|
1441
|
+
}, this.analyticsContext).catch(function() {});
|
|
1049
1442
|
if (this.debug) {
|
|
1050
1443
|
console.log("[CONTINUOUS-FETCH] Using preloaded ad from pool (preloaded in advance, ready immediately!)");
|
|
1051
1444
|
}
|
|
@@ -1159,7 +1552,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1159
1552
|
source: "hls",
|
|
1160
1553
|
vastUrl: firstAdUrl,
|
|
1161
1554
|
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
1162
|
-
}).catch(function() {});
|
|
1555
|
+
}, this.analyticsContext).catch(function() {});
|
|
1163
1556
|
if (this.debug) {
|
|
1164
1557
|
console.log("[CONTINUOUS-FETCH] First ad request successful, starting playback");
|
|
1165
1558
|
}
|
|
@@ -1623,7 +2016,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1623
2016
|
source: "hls",
|
|
1624
2017
|
vastUrl: preloaded.vastUrl,
|
|
1625
2018
|
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
1626
|
-
}).catch(function() {});
|
|
2019
|
+
}, this.analyticsContext).catch(function() {});
|
|
1627
2020
|
_state.label = 1;
|
|
1628
2021
|
case 1:
|
|
1629
2022
|
_state.trys.push([
|
|
@@ -1856,7 +2249,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
1856
2249
|
source: "hls",
|
|
1857
2250
|
vastUrl: vastTagUrl,
|
|
1858
2251
|
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
1859
|
-
}).catch(function() {});
|
|
2252
|
+
}, this.analyticsContext).catch(function() {});
|
|
1860
2253
|
this.timing.clearAdRequestWatchdog();
|
|
1861
2254
|
if (this.timing.activeAdRequestToken !== requestToken) return [
|
|
1862
2255
|
2
|