stormcloud-video-player 0.3.60 → 0.3.62
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 +445 -359
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +26 -16
- package/lib/index.d.ts +26 -16
- package/lib/index.js +445 -359
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +265 -224
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +1 -1
- package/lib/players/HlsPlayer.cjs +265 -224
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.d.cts +1 -1
- package/lib/players/index.cjs +265 -224
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.d.cts +1 -1
- package/lib/sdk/ima.d.cts +1 -1
- package/lib/{types-Vj55FghO.d.cts → types-BJPNhfLV.d.cts} +14 -4
- package/lib/ui/StormcloudVideoPlayer.cjs +445 -359
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.d.cts +1 -1
- package/lib/utils/tracking.cjs +210 -217
- package/lib/utils/tracking.cjs.map +1 -1
- package/lib/utils/tracking.d.cts +11 -13
- package/package.json +1 -1
|
@@ -2608,40 +2608,66 @@ function getBrowserID(clientInfo) {
|
|
|
2608
2608
|
});
|
|
2609
2609
|
})();
|
|
2610
2610
|
}
|
|
2611
|
-
|
|
2611
|
+
var PLAYER_TRACKING_BASE_URL = "https://adstorm.co/api-adstorm-dev/adstorm/player-tracking";
|
|
2612
|
+
var TRACK_URL = "".concat(PLAYER_TRACKING_BASE_URL, "/metrics/ingest");
|
|
2613
|
+
var HEARTBEAT_URL = "".concat(PLAYER_TRACKING_BASE_URL, "/heartbeat");
|
|
2614
|
+
var IMPRESSIONS_URL = "".concat(PLAYER_TRACKING_BASE_URL, "/impressions/ingest");
|
|
2615
|
+
function buildHeaders(licenseKey) {
|
|
2616
|
+
var headers = {
|
|
2617
|
+
"Content-Type": "application/json"
|
|
2618
|
+
};
|
|
2619
|
+
if (licenseKey) {
|
|
2620
|
+
headers["Authorization"] = "Bearer ".concat(licenseKey);
|
|
2621
|
+
}
|
|
2622
|
+
return headers;
|
|
2623
|
+
}
|
|
2624
|
+
function sendTrackRequest(licenseKey, body) {
|
|
2612
2625
|
return _async_to_generator(function() {
|
|
2613
|
-
var
|
|
2626
|
+
var response;
|
|
2614
2627
|
return _ts_generator(this, function(_state) {
|
|
2615
2628
|
switch(_state.label){
|
|
2616
2629
|
case 0:
|
|
2617
|
-
_state.trys.push([
|
|
2618
|
-
0,
|
|
2619
|
-
4,
|
|
2620
|
-
,
|
|
2621
|
-
5
|
|
2622
|
-
]);
|
|
2623
|
-
clientInfo = getClientInfo();
|
|
2624
2630
|
return [
|
|
2625
2631
|
4,
|
|
2626
|
-
|
|
2632
|
+
fetch(TRACK_URL, {
|
|
2633
|
+
method: "POST",
|
|
2634
|
+
headers: buildHeaders(licenseKey),
|
|
2635
|
+
body: JSON.stringify(body)
|
|
2636
|
+
})
|
|
2627
2637
|
];
|
|
2628
2638
|
case 1:
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
}
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2639
|
+
response = _state.sent();
|
|
2640
|
+
if (!response.ok) {
|
|
2641
|
+
throw new Error("HTTP error! status: ".concat(response.status));
|
|
2642
|
+
}
|
|
2643
|
+
return [
|
|
2644
|
+
4,
|
|
2645
|
+
response.json()
|
|
2646
|
+
];
|
|
2647
|
+
case 2:
|
|
2648
|
+
_state.sent();
|
|
2649
|
+
return [
|
|
2650
|
+
2
|
|
2651
|
+
];
|
|
2652
|
+
}
|
|
2653
|
+
});
|
|
2654
|
+
})();
|
|
2655
|
+
}
|
|
2656
|
+
function postJson(url, licenseKey, body) {
|
|
2657
|
+
return _async_to_generator(function() {
|
|
2658
|
+
var response;
|
|
2659
|
+
return _ts_generator(this, function(_state) {
|
|
2660
|
+
switch(_state.label){
|
|
2661
|
+
case 0:
|
|
2636
2662
|
return [
|
|
2637
2663
|
4,
|
|
2638
|
-
fetch(
|
|
2664
|
+
fetch(url, {
|
|
2639
2665
|
method: "POST",
|
|
2640
|
-
headers:
|
|
2641
|
-
body: JSON.stringify(
|
|
2666
|
+
headers: buildHeaders(licenseKey),
|
|
2667
|
+
body: JSON.stringify(body)
|
|
2642
2668
|
})
|
|
2643
2669
|
];
|
|
2644
|
-
case
|
|
2670
|
+
case 1:
|
|
2645
2671
|
response = _state.sent();
|
|
2646
2672
|
if (!response.ok) {
|
|
2647
2673
|
throw new Error("HTTP error! status: ".concat(response.status));
|
|
@@ -2650,35 +2676,63 @@ function sendInitialTracking(licenseKey) {
|
|
|
2650
2676
|
4,
|
|
2651
2677
|
response.json()
|
|
2652
2678
|
];
|
|
2653
|
-
case
|
|
2679
|
+
case 2:
|
|
2654
2680
|
_state.sent();
|
|
2655
2681
|
return [
|
|
2656
|
-
|
|
2657
|
-
5
|
|
2682
|
+
2
|
|
2658
2683
|
];
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2684
|
+
}
|
|
2685
|
+
});
|
|
2686
|
+
})();
|
|
2687
|
+
}
|
|
2688
|
+
function buildPlayerMetricEvent(_0) {
|
|
2689
|
+
return _async_to_generator(function(licenseKey) {
|
|
2690
|
+
var context, flags, _flags_captureAt, clientInfo, browserId, captureAt;
|
|
2691
|
+
var _arguments = arguments;
|
|
2692
|
+
return _ts_generator(this, function(_state) {
|
|
2693
|
+
switch(_state.label){
|
|
2694
|
+
case 0:
|
|
2695
|
+
context = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : {}, flags = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {};
|
|
2696
|
+
clientInfo = getClientInfo();
|
|
2662
2697
|
return [
|
|
2663
|
-
|
|
2664
|
-
|
|
2698
|
+
4,
|
|
2699
|
+
getBrowserID(clientInfo)
|
|
2665
2700
|
];
|
|
2666
|
-
case
|
|
2701
|
+
case 1:
|
|
2702
|
+
browserId = _state.sent();
|
|
2703
|
+
captureAt = (_flags_captureAt = flags.captureAt) !== null && _flags_captureAt !== void 0 ? _flags_captureAt : /* @__PURE__ */ new Date().toISOString();
|
|
2667
2704
|
return [
|
|
2668
|
-
2
|
|
2705
|
+
2,
|
|
2706
|
+
{
|
|
2707
|
+
player_id: browserId,
|
|
2708
|
+
browserId: browserId,
|
|
2709
|
+
device_type: clientInfo.deviceType,
|
|
2710
|
+
deviceType: clientInfo.deviceType,
|
|
2711
|
+
input_stream_type: context.inputStreamType,
|
|
2712
|
+
os: clientInfo.os,
|
|
2713
|
+
ad_loaded: flags.adLoaded,
|
|
2714
|
+
ad_detect: flags.adDetect,
|
|
2715
|
+
license_key: licenseKey,
|
|
2716
|
+
capture_at: captureAt,
|
|
2717
|
+
timestamp: captureAt
|
|
2718
|
+
}
|
|
2669
2719
|
];
|
|
2670
2720
|
}
|
|
2671
2721
|
});
|
|
2672
|
-
})();
|
|
2722
|
+
}).apply(this, arguments);
|
|
2673
2723
|
}
|
|
2674
|
-
function
|
|
2675
|
-
return _async_to_generator(function() {
|
|
2676
|
-
var clientInfo, browserId,
|
|
2724
|
+
function sendInitialTracking(_0) {
|
|
2725
|
+
return _async_to_generator(function(licenseKey) {
|
|
2726
|
+
var context, clientInfo, browserId, trackingData, error;
|
|
2727
|
+
var _arguments = arguments;
|
|
2677
2728
|
return _ts_generator(this, function(_state) {
|
|
2678
2729
|
switch(_state.label){
|
|
2679
2730
|
case 0:
|
|
2731
|
+
context = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : {};
|
|
2732
|
+
_state.label = 1;
|
|
2733
|
+
case 1:
|
|
2680
2734
|
_state.trys.push([
|
|
2681
|
-
|
|
2735
|
+
1,
|
|
2682
2736
|
4,
|
|
2683
2737
|
,
|
|
2684
2738
|
5
|
|
@@ -2688,35 +2742,29 @@ function sendHeartbeat(licenseKey) {
|
|
|
2688
2742
|
4,
|
|
2689
2743
|
getBrowserID(clientInfo)
|
|
2690
2744
|
];
|
|
2691
|
-
case
|
|
2745
|
+
case 2:
|
|
2692
2746
|
browserId = _state.sent();
|
|
2693
|
-
|
|
2694
|
-
browserId: browserId
|
|
2695
|
-
|
|
2696
|
-
};
|
|
2697
|
-
headers = {
|
|
2698
|
-
"Content-Type": "application/json"
|
|
2699
|
-
};
|
|
2700
|
-
if (licenseKey) {
|
|
2701
|
-
headers["Authorization"] = "Bearer ".concat(licenseKey);
|
|
2702
|
-
}
|
|
2747
|
+
trackingData = _object_spread({
|
|
2748
|
+
browserId: browserId
|
|
2749
|
+
}, clientInfo);
|
|
2703
2750
|
return [
|
|
2704
2751
|
4,
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2752
|
+
sendTrackRequest(licenseKey, {
|
|
2753
|
+
events: [
|
|
2754
|
+
{
|
|
2755
|
+
player_id: browserId,
|
|
2756
|
+
device_type: clientInfo.deviceType,
|
|
2757
|
+
input_stream_type: context.inputStreamType,
|
|
2758
|
+
os: clientInfo.os,
|
|
2759
|
+
ad_loaded: false,
|
|
2760
|
+
ad_detect: false,
|
|
2761
|
+
license_key: licenseKey,
|
|
2762
|
+
capture_at: /* @__PURE__ */ new Date().toISOString()
|
|
2763
|
+
}
|
|
2764
|
+
],
|
|
2765
|
+
trackingData: trackingData
|
|
2709
2766
|
})
|
|
2710
2767
|
];
|
|
2711
|
-
case 2:
|
|
2712
|
-
response = _state.sent();
|
|
2713
|
-
if (!response.ok) {
|
|
2714
|
-
throw new Error("HTTP error! status: ".concat(response.status));
|
|
2715
|
-
}
|
|
2716
|
-
return [
|
|
2717
|
-
4,
|
|
2718
|
-
response.json()
|
|
2719
|
-
];
|
|
2720
2768
|
case 3:
|
|
2721
2769
|
_state.sent();
|
|
2722
2770
|
return [
|
|
@@ -2725,7 +2773,7 @@ function sendHeartbeat(licenseKey) {
|
|
|
2725
2773
|
];
|
|
2726
2774
|
case 4:
|
|
2727
2775
|
error = _state.sent();
|
|
2728
|
-
console.error("[StormcloudVideoPlayer] Error sending
|
|
2776
|
+
console.error("[StormcloudVideoPlayer] Error sending initial tracking data:", error);
|
|
2729
2777
|
return [
|
|
2730
2778
|
3,
|
|
2731
2779
|
5
|
|
@@ -2736,95 +2784,74 @@ function sendHeartbeat(licenseKey) {
|
|
|
2736
2784
|
];
|
|
2737
2785
|
}
|
|
2738
2786
|
});
|
|
2739
|
-
})();
|
|
2787
|
+
}).apply(this, arguments);
|
|
2740
2788
|
}
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
}
|
|
2746
|
-
if (source === "preload" || source === "ssp") {
|
|
2747
|
-
return source === "ssp" ? "prebid" : "ima";
|
|
2748
|
-
}
|
|
2749
|
-
return adPlayerType === "hls" ? "hls" : "ima";
|
|
2750
|
-
}
|
|
2751
|
-
function postAdTracking(licenseKey, body) {
|
|
2752
|
-
return _async_to_generator(function() {
|
|
2753
|
-
var headers, response;
|
|
2789
|
+
function sendAdDetectTracking(_0, _1) {
|
|
2790
|
+
return _async_to_generator(function(licenseKey, adDetectInfo) {
|
|
2791
|
+
var context, error;
|
|
2792
|
+
var _arguments = arguments;
|
|
2754
2793
|
return _ts_generator(this, function(_state) {
|
|
2755
2794
|
switch(_state.label){
|
|
2756
2795
|
case 0:
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
};
|
|
2760
|
-
if (licenseKey) {
|
|
2761
|
-
headers["Authorization"] = "Bearer ".concat(licenseKey);
|
|
2762
|
-
}
|
|
2763
|
-
return [
|
|
2764
|
-
4,
|
|
2765
|
-
fetch(TRACK_API_URL, {
|
|
2766
|
-
method: "POST",
|
|
2767
|
-
headers: headers,
|
|
2768
|
-
body: JSON.stringify(body)
|
|
2769
|
-
})
|
|
2770
|
-
];
|
|
2796
|
+
context = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {};
|
|
2797
|
+
_state.label = 1;
|
|
2771
2798
|
case 1:
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2799
|
+
_state.trys.push([
|
|
2800
|
+
1,
|
|
2801
|
+
3,
|
|
2802
|
+
,
|
|
2803
|
+
4
|
|
2804
|
+
]);
|
|
2776
2805
|
return [
|
|
2777
2806
|
4,
|
|
2778
|
-
|
|
2807
|
+
sendHeartbeat(licenseKey, context, {
|
|
2808
|
+
adDetect: true,
|
|
2809
|
+
captureAt: adDetectInfo.timestamp
|
|
2810
|
+
})
|
|
2779
2811
|
];
|
|
2780
2812
|
case 2:
|
|
2781
2813
|
_state.sent();
|
|
2814
|
+
return [
|
|
2815
|
+
3,
|
|
2816
|
+
4
|
|
2817
|
+
];
|
|
2818
|
+
case 3:
|
|
2819
|
+
error = _state.sent();
|
|
2820
|
+
console.error("[StormcloudVideoPlayer] Error sending ad detect tracking:", error);
|
|
2821
|
+
return [
|
|
2822
|
+
3,
|
|
2823
|
+
4
|
|
2824
|
+
];
|
|
2825
|
+
case 4:
|
|
2782
2826
|
return [
|
|
2783
2827
|
2
|
|
2784
2828
|
];
|
|
2785
2829
|
}
|
|
2786
2830
|
});
|
|
2787
|
-
})();
|
|
2831
|
+
}).apply(this, arguments);
|
|
2788
2832
|
}
|
|
2789
|
-
function
|
|
2790
|
-
return _async_to_generator(function() {
|
|
2791
|
-
var
|
|
2833
|
+
function sendAdLoadedTracking(_0, _1) {
|
|
2834
|
+
return _async_to_generator(function(licenseKey, adLoadedInfo) {
|
|
2835
|
+
var context, error;
|
|
2836
|
+
var _arguments = arguments;
|
|
2792
2837
|
return _ts_generator(this, function(_state) {
|
|
2793
2838
|
switch(_state.label){
|
|
2794
2839
|
case 0:
|
|
2840
|
+
context = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {};
|
|
2841
|
+
_state.label = 1;
|
|
2842
|
+
case 1:
|
|
2795
2843
|
_state.trys.push([
|
|
2796
|
-
|
|
2844
|
+
1,
|
|
2797
2845
|
3,
|
|
2798
2846
|
,
|
|
2799
2847
|
4
|
|
2800
2848
|
]);
|
|
2801
|
-
clientInfo = getClientInfo();
|
|
2802
|
-
return [
|
|
2803
|
-
4,
|
|
2804
|
-
getBrowserID(clientInfo)
|
|
2805
|
-
];
|
|
2806
|
-
case 1:
|
|
2807
|
-
browserId = _state.sent();
|
|
2808
|
-
adDetectInfo = _object_spread({
|
|
2809
|
-
source: (_payload_source = payload.source) !== null && _payload_source !== void 0 ? _payload_source : "scte35",
|
|
2810
|
-
timestamp: (_payload_timestamp = payload.timestamp) !== null && _payload_timestamp !== void 0 ? _payload_timestamp : /* @__PURE__ */ new Date().toISOString()
|
|
2811
|
-
}, payload.durationSeconds != null && {
|
|
2812
|
-
durationSeconds: payload.durationSeconds
|
|
2813
|
-
}, payload.ptsSeconds != null && {
|
|
2814
|
-
ptsSeconds: payload.ptsSeconds
|
|
2815
|
-
}, payload.detectedAtFragmentSn != null && {
|
|
2816
|
-
detectedAtFragmentSn: payload.detectedAtFragmentSn
|
|
2817
|
-
});
|
|
2818
|
-
body = _object_spread_props(_object_spread({
|
|
2819
|
-
browserId: browserId
|
|
2820
|
-
}, clientInfo, licenseKey && {
|
|
2821
|
-
licenseKey: licenseKey
|
|
2822
|
-
}), {
|
|
2823
|
-
adDetectInfo: adDetectInfo
|
|
2824
|
-
});
|
|
2825
2849
|
return [
|
|
2826
2850
|
4,
|
|
2827
|
-
|
|
2851
|
+
sendHeartbeat(licenseKey, context, {
|
|
2852
|
+
adLoaded: true,
|
|
2853
|
+
captureAt: adLoadedInfo.timestamp
|
|
2854
|
+
})
|
|
2828
2855
|
];
|
|
2829
2856
|
case 2:
|
|
2830
2857
|
_state.sent();
|
|
@@ -2834,7 +2861,7 @@ function sendAdDetectTracking(licenseKey, payload) {
|
|
|
2834
2861
|
];
|
|
2835
2862
|
case 3:
|
|
2836
2863
|
error = _state.sent();
|
|
2837
|
-
console.error("[StormcloudVideoPlayer] Error sending ad
|
|
2864
|
+
console.error("[StormcloudVideoPlayer] Error sending ad loaded tracking:", error);
|
|
2838
2865
|
return [
|
|
2839
2866
|
3,
|
|
2840
2867
|
4
|
|
@@ -2845,126 +2872,116 @@ function sendAdDetectTracking(licenseKey, payload) {
|
|
|
2845
2872
|
];
|
|
2846
2873
|
}
|
|
2847
2874
|
});
|
|
2848
|
-
})();
|
|
2875
|
+
}).apply(this, arguments);
|
|
2849
2876
|
}
|
|
2850
|
-
function
|
|
2851
|
-
return _async_to_generator(function() {
|
|
2852
|
-
var
|
|
2877
|
+
function sendAdImpressionTracking(_0, _1) {
|
|
2878
|
+
return _async_to_generator(function(licenseKey, adImpressionInfo) {
|
|
2879
|
+
var context, metricEvent, error;
|
|
2880
|
+
var _arguments = arguments;
|
|
2853
2881
|
return _ts_generator(this, function(_state) {
|
|
2854
2882
|
switch(_state.label){
|
|
2855
2883
|
case 0:
|
|
2884
|
+
context = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {};
|
|
2885
|
+
_state.label = 1;
|
|
2886
|
+
case 1:
|
|
2856
2887
|
_state.trys.push([
|
|
2857
|
-
|
|
2858
|
-
|
|
2888
|
+
1,
|
|
2889
|
+
4,
|
|
2859
2890
|
,
|
|
2860
|
-
|
|
2891
|
+
5
|
|
2861
2892
|
]);
|
|
2862
|
-
clientInfo = getClientInfo();
|
|
2863
2893
|
return [
|
|
2864
2894
|
4,
|
|
2865
|
-
|
|
2895
|
+
buildPlayerMetricEvent(licenseKey, context, {
|
|
2896
|
+
captureAt: adImpressionInfo.timestamp
|
|
2897
|
+
})
|
|
2866
2898
|
];
|
|
2867
|
-
case
|
|
2868
|
-
|
|
2869
|
-
source = mapToAdTrackingSource(payload.source, adPlayerType);
|
|
2870
|
-
adLoadedInfo = _object_spread({
|
|
2871
|
-
source: source,
|
|
2872
|
-
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
2873
|
-
}, payload.vastUrl != null && {
|
|
2874
|
-
vastUrl: payload.vastUrl
|
|
2875
|
-
}, payload.durationSeconds != null && {
|
|
2876
|
-
durationSeconds: payload.durationSeconds
|
|
2877
|
-
});
|
|
2878
|
-
body = _object_spread_props(_object_spread({
|
|
2879
|
-
browserId: browserId
|
|
2880
|
-
}, clientInfo, licenseKey && {
|
|
2881
|
-
licenseKey: licenseKey
|
|
2882
|
-
}), {
|
|
2883
|
-
adLoadedInfo: adLoadedInfo
|
|
2884
|
-
});
|
|
2899
|
+
case 2:
|
|
2900
|
+
metricEvent = _state.sent();
|
|
2885
2901
|
return [
|
|
2886
2902
|
4,
|
|
2887
|
-
|
|
2903
|
+
Promise.all([
|
|
2904
|
+
postJson(HEARTBEAT_URL, licenseKey, metricEvent),
|
|
2905
|
+
postJson(IMPRESSIONS_URL, licenseKey, {
|
|
2906
|
+
events: [
|
|
2907
|
+
{
|
|
2908
|
+
player_id: metricEvent.player_id,
|
|
2909
|
+
ad_played_count: 1,
|
|
2910
|
+
ad_url: adImpressionInfo.adUrl,
|
|
2911
|
+
license_key: licenseKey,
|
|
2912
|
+
capture_at: adImpressionInfo.timestamp
|
|
2913
|
+
}
|
|
2914
|
+
]
|
|
2915
|
+
})
|
|
2916
|
+
])
|
|
2888
2917
|
];
|
|
2889
|
-
case
|
|
2918
|
+
case 3:
|
|
2890
2919
|
_state.sent();
|
|
2891
2920
|
return [
|
|
2892
2921
|
3,
|
|
2893
|
-
|
|
2922
|
+
5
|
|
2894
2923
|
];
|
|
2895
|
-
case
|
|
2924
|
+
case 4:
|
|
2896
2925
|
error = _state.sent();
|
|
2897
|
-
console.error("[StormcloudVideoPlayer] Error sending ad
|
|
2926
|
+
console.error("[StormcloudVideoPlayer] Error sending ad impression tracking:", error);
|
|
2898
2927
|
return [
|
|
2899
2928
|
3,
|
|
2900
|
-
|
|
2929
|
+
5
|
|
2901
2930
|
];
|
|
2902
|
-
case
|
|
2931
|
+
case 5:
|
|
2903
2932
|
return [
|
|
2904
2933
|
2
|
|
2905
2934
|
];
|
|
2906
2935
|
}
|
|
2907
2936
|
});
|
|
2908
|
-
})();
|
|
2937
|
+
}).apply(this, arguments);
|
|
2909
2938
|
}
|
|
2910
|
-
function
|
|
2911
|
-
return _async_to_generator(function() {
|
|
2912
|
-
var
|
|
2939
|
+
function sendHeartbeat(_0) {
|
|
2940
|
+
return _async_to_generator(function(licenseKey) {
|
|
2941
|
+
var context, flags, heartbeatData, error;
|
|
2942
|
+
var _arguments = arguments;
|
|
2913
2943
|
return _ts_generator(this, function(_state) {
|
|
2914
2944
|
switch(_state.label){
|
|
2915
2945
|
case 0:
|
|
2946
|
+
context = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : {}, flags = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {};
|
|
2947
|
+
_state.label = 1;
|
|
2948
|
+
case 1:
|
|
2916
2949
|
_state.trys.push([
|
|
2917
|
-
|
|
2918
|
-
|
|
2950
|
+
1,
|
|
2951
|
+
4,
|
|
2919
2952
|
,
|
|
2920
|
-
|
|
2953
|
+
5
|
|
2921
2954
|
]);
|
|
2922
|
-
clientInfo = getClientInfo();
|
|
2923
2955
|
return [
|
|
2924
2956
|
4,
|
|
2925
|
-
|
|
2957
|
+
buildPlayerMetricEvent(licenseKey, context, flags)
|
|
2926
2958
|
];
|
|
2927
|
-
case
|
|
2928
|
-
|
|
2929
|
-
source = mapToAdTrackingSource(payload.source, adPlayerType);
|
|
2930
|
-
adImpressionInfo = _object_spread({
|
|
2931
|
-
source: source,
|
|
2932
|
-
adIndex: payload.adIndex,
|
|
2933
|
-
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
2934
|
-
}, payload.durationSeconds != null && {
|
|
2935
|
-
durationSeconds: payload.durationSeconds
|
|
2936
|
-
});
|
|
2937
|
-
body = _object_spread_props(_object_spread({
|
|
2938
|
-
browserId: browserId
|
|
2939
|
-
}, clientInfo, licenseKey && {
|
|
2940
|
-
licenseKey: licenseKey
|
|
2941
|
-
}), {
|
|
2942
|
-
adImpressionInfo: adImpressionInfo
|
|
2943
|
-
});
|
|
2959
|
+
case 2:
|
|
2960
|
+
heartbeatData = _state.sent();
|
|
2944
2961
|
return [
|
|
2945
2962
|
4,
|
|
2946
|
-
|
|
2963
|
+
postJson(HEARTBEAT_URL, licenseKey, heartbeatData)
|
|
2947
2964
|
];
|
|
2948
|
-
case
|
|
2965
|
+
case 3:
|
|
2949
2966
|
_state.sent();
|
|
2950
2967
|
return [
|
|
2951
2968
|
3,
|
|
2952
|
-
|
|
2969
|
+
5
|
|
2953
2970
|
];
|
|
2954
|
-
case
|
|
2971
|
+
case 4:
|
|
2955
2972
|
error = _state.sent();
|
|
2956
|
-
console.error("[StormcloudVideoPlayer] Error sending
|
|
2973
|
+
console.error("[StormcloudVideoPlayer] Error sending heartbeat:", error);
|
|
2957
2974
|
return [
|
|
2958
2975
|
3,
|
|
2959
|
-
|
|
2976
|
+
5
|
|
2960
2977
|
];
|
|
2961
|
-
case
|
|
2978
|
+
case 5:
|
|
2962
2979
|
return [
|
|
2963
2980
|
2
|
|
2964
2981
|
];
|
|
2965
2982
|
}
|
|
2966
2983
|
});
|
|
2967
|
-
})();
|
|
2984
|
+
}).apply(this, arguments);
|
|
2968
2985
|
}
|
|
2969
2986
|
// src/utils/polyfills.ts
|
|
2970
2987
|
function polyfillURLSearchParams() {
|
|
@@ -3320,7 +3337,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3320
3337
|
key: "load",
|
|
3321
3338
|
value: function load() {
|
|
3322
3339
|
return _async_to_generator(function() {
|
|
3323
|
-
var _this, error, _this_config_lowLatencyMode, _this_video_play;
|
|
3340
|
+
var _this, error, _this_config_isLiveStream, _this_config_lowLatencyMode, _this_video_play;
|
|
3324
3341
|
return _ts_generator(this, function(_state) {
|
|
3325
3342
|
switch(_state.label){
|
|
3326
3343
|
case 0:
|
|
@@ -3364,7 +3381,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3364
3381
|
this.nativeHlsMode = true;
|
|
3365
3382
|
this.videoSrcProtection = this.config.src;
|
|
3366
3383
|
this.video.src = this.config.src;
|
|
3367
|
-
this.isLiveStream = (_this_config_lowLatencyMode = this.config.lowLatencyMode) !== null && _this_config_lowLatencyMode !== void 0 ? _this_config_lowLatencyMode : false;
|
|
3384
|
+
this.isLiveStream = (_this_config_isLiveStream = this.config.isLiveStream) !== null && _this_config_isLiveStream !== void 0 ? _this_config_isLiveStream : (_this_config_lowLatencyMode = this.config.lowLatencyMode) !== null && _this_config_lowLatencyMode !== void 0 ? _this_config_lowLatencyMode : false;
|
|
3368
3385
|
if (this.config.debugAdTiming) {
|
|
3369
3386
|
console.log("[StormcloudVideoPlayer] Using native HLS playback - VOD mode:", {
|
|
3370
3387
|
isLive: this.isLiveStream,
|
|
@@ -3415,19 +3432,28 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3415
3432
|
});
|
|
3416
3433
|
this.hls.on(import_hls2.default.Events.MANIFEST_PARSED, function(_, data) {
|
|
3417
3434
|
return _async_to_generator(function() {
|
|
3418
|
-
var
|
|
3435
|
+
var _this_config_isLiveStream, _ref, _this_config_minSegmentsBeforePlay, _this_hls_levels, _this_hls, prerollKey, adBehavior, minSegments, _this_video_play;
|
|
3419
3436
|
return _ts_generator(this, function(_state) {
|
|
3420
3437
|
switch(_state.label){
|
|
3421
3438
|
case 0:
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3439
|
+
this.isLiveStream = (_this_config_isLiveStream = this.config.isLiveStream) !== null && _this_config_isLiveStream !== void 0 ? _this_config_isLiveStream : (_ref = (_this_hls = this.hls) === null || _this_hls === void 0 ? void 0 : (_this_hls_levels = _this_hls.levels) === null || _this_hls_levels === void 0 ? void 0 : _this_hls_levels.some(function(level) {
|
|
3440
|
+
var _level_details, _level_details1;
|
|
3441
|
+
return (level === null || level === void 0 ? void 0 : (_level_details = level.details) === null || _level_details === void 0 ? void 0 : _level_details.live) === true || (level === null || level === void 0 ? void 0 : (_level_details1 = level.details) === null || _level_details1 === void 0 ? void 0 : _level_details1.type) === "LIVE";
|
|
3442
|
+
})) !== null && _ref !== void 0 ? _ref : false;
|
|
3443
|
+
if (!this.isLiveStream && this.vmapBreaks.length === 0 && this.apiVastTagUrl) {
|
|
3444
|
+
prerollKey = "synthetic-vod-preroll";
|
|
3445
|
+
if (!this.consumedVmapBreakIds.has(prerollKey)) {
|
|
3446
|
+
this.vmapBreaks = [
|
|
3447
|
+
{
|
|
3448
|
+
id: prerollKey,
|
|
3449
|
+
startTimeMs: 0,
|
|
3450
|
+
vastTagUrl: this.apiVastTagUrl
|
|
3451
|
+
}
|
|
3452
|
+
];
|
|
3453
|
+
if (this.config.debugAdTiming) {
|
|
3454
|
+
console.log("[StormcloudVideoPlayer] Injected synthetic VOD preroll from apiVastTagUrl");
|
|
3455
|
+
}
|
|
3456
|
+
}
|
|
3431
3457
|
}
|
|
3432
3458
|
if (this.config.debugAdTiming) {
|
|
3433
3459
|
adBehavior = this.shouldContinueLiveStreamDuringAds() ? "live (main video continues muted during ads)" : "vod (main video pauses during ads)";
|
|
@@ -3757,8 +3783,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3757
3783
|
var _this = this;
|
|
3758
3784
|
this.ima.on("all_ads_completed", function() {
|
|
3759
3785
|
sendAdImpressionTracking(_this.config.licenseKey, {
|
|
3760
|
-
|
|
3761
|
-
|
|
3786
|
+
source: "ima",
|
|
3787
|
+
adIndex: _this.currentAdIndex,
|
|
3788
|
+
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
3789
|
+
}).catch(function() {});
|
|
3762
3790
|
var remaining = _this.getRemainingAdMs();
|
|
3763
3791
|
_this.consecutiveFailures = 0;
|
|
3764
3792
|
if (_this.config.debugAdTiming) {
|
|
@@ -3819,8 +3847,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3819
3847
|
});
|
|
3820
3848
|
this.ima.on("content_resume", function() {
|
|
3821
3849
|
sendAdImpressionTracking(_this.config.licenseKey, {
|
|
3822
|
-
|
|
3823
|
-
|
|
3850
|
+
source: "ima",
|
|
3851
|
+
adIndex: _this.currentAdIndex,
|
|
3852
|
+
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
3853
|
+
}).catch(function() {});
|
|
3824
3854
|
if (!_this.video.muted) {
|
|
3825
3855
|
_this.video.muted = true;
|
|
3826
3856
|
_this.video.volume = 0;
|
|
@@ -4454,7 +4484,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4454
4484
|
var detectPayload = {};
|
|
4455
4485
|
if (marker.durationSeconds != null) detectPayload.durationSeconds = marker.durationSeconds;
|
|
4456
4486
|
if (marker.ptsSeconds != null) detectPayload.ptsSeconds = marker.ptsSeconds;
|
|
4457
|
-
sendAdDetectTracking(this.config.licenseKey,
|
|
4487
|
+
sendAdDetectTracking(this.config.licenseKey, _object_spread({
|
|
4488
|
+
source: "scte35",
|
|
4489
|
+
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
4490
|
+
}, detectPayload)).catch(function() {});
|
|
4458
4491
|
}
|
|
4459
4492
|
var hasPrefetchedAds = this.pendingAdBreak && this.pendingAdBreak.vastUrls.length > 0;
|
|
4460
4493
|
var durationMs = marker.durationSeconds != null ? marker.durationSeconds * 1e3 : ((_this_pendingAdBreak = this.pendingAdBreak) === null || _this_pendingAdBreak === void 0 ? void 0 : _this_pendingAdBreak.marker.durationSeconds) != null ? this.pendingAdBreak.marker.durationSeconds * 1e3 : void 0;
|
|
@@ -5696,7 +5729,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5696
5729
|
if (marker.durationSeconds != null) detectPayload.durationSeconds = marker.durationSeconds;
|
|
5697
5730
|
if (marker.ptsSeconds != null) detectPayload.ptsSeconds = marker.ptsSeconds;
|
|
5698
5731
|
if (fragmentSn !== void 0) detectPayload.detectedAtFragmentSn = fragmentSn;
|
|
5699
|
-
sendAdDetectTracking(this.config.licenseKey,
|
|
5732
|
+
sendAdDetectTracking(this.config.licenseKey, _object_spread({
|
|
5733
|
+
source: "scte35",
|
|
5734
|
+
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
5735
|
+
}, detectPayload)).catch(function() {});
|
|
5700
5736
|
if (this.config.debugAdTiming) {
|
|
5701
5737
|
console.log("[PREFETCH] \uD83D\uDD04 Starting ad prefetch for upcoming ad break");
|
|
5702
5738
|
console.log("[PREFETCH] \uD83D\uDCCB Pre-generated ".concat(generatedUrls.length, " VAST URLs"));
|
|
@@ -6177,9 +6213,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6177
6213
|
preloadedController = preloaded.imaController;
|
|
6178
6214
|
usePreloadedAd = true;
|
|
6179
6215
|
sendAdLoadedTracking(this.config.licenseKey, {
|
|
6180
|
-
source: "
|
|
6181
|
-
vastUrl: firstAdUrl
|
|
6182
|
-
|
|
6216
|
+
source: "ima",
|
|
6217
|
+
vastUrl: firstAdUrl,
|
|
6218
|
+
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
6219
|
+
}).catch(function() {});
|
|
6183
6220
|
if (this.config.debugAdTiming) {
|
|
6184
6221
|
console.log("[CONTINUOUS-FETCH] \uD83D\uDE80 Using preloaded ad from pool (preloaded in advance, ready immediately!)");
|
|
6185
6222
|
console.log("[CONTINUOUS-FETCH] Pool still has ".concat(this.preloadPool.length, " preloaded ads ready"));
|
|
@@ -6269,9 +6306,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6269
6306
|
case 5:
|
|
6270
6307
|
_state.sent();
|
|
6271
6308
|
sendAdLoadedTracking(this.config.licenseKey, {
|
|
6272
|
-
source: "
|
|
6273
|
-
vastUrl: firstAdUrl
|
|
6274
|
-
|
|
6309
|
+
source: "ima",
|
|
6310
|
+
vastUrl: firstAdUrl,
|
|
6311
|
+
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
6312
|
+
}).catch(function() {});
|
|
6275
6313
|
if (this.config.debugAdTiming) {
|
|
6276
6314
|
console.log("[CONTINUOUS-FETCH] \u2705 First ad request successful, starting playback");
|
|
6277
6315
|
}
|
|
@@ -6667,9 +6705,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6667
6705
|
console.log("[CONTINUOUS-FETCH] \uD83C\uDFAF Using preloaded ad from pool (".concat(this.preloadPool.length, " remaining in pool)"));
|
|
6668
6706
|
}
|
|
6669
6707
|
sendAdLoadedTracking(this.config.licenseKey, {
|
|
6670
|
-
source: "
|
|
6671
|
-
vastUrl: preloaded.vastUrl
|
|
6672
|
-
|
|
6708
|
+
source: "ima",
|
|
6709
|
+
vastUrl: preloaded.vastUrl,
|
|
6710
|
+
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
6711
|
+
}).catch(function() {});
|
|
6673
6712
|
_state.label = 1;
|
|
6674
6713
|
case 1:
|
|
6675
6714
|
_state.trys.push([
|
|
@@ -7421,9 +7460,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7421
7460
|
case 3:
|
|
7422
7461
|
_state.sent();
|
|
7423
7462
|
sendAdLoadedTracking(this.config.licenseKey, {
|
|
7424
|
-
source: "
|
|
7425
|
-
vastUrl: vastTagUrl
|
|
7426
|
-
|
|
7463
|
+
source: "ima",
|
|
7464
|
+
vastUrl: vastTagUrl,
|
|
7465
|
+
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
7466
|
+
}).catch(function() {});
|
|
7427
7467
|
this.clearAdRequestWatchdog();
|
|
7428
7468
|
if (this.activeAdRequestToken !== requestToken) {
|
|
7429
7469
|
return [
|
|
@@ -7851,7 +7891,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7851
7891
|
continue;
|
|
7852
7892
|
}
|
|
7853
7893
|
var end = breakStartMs + (b.durationMs || 0);
|
|
7854
|
-
|
|
7894
|
+
var effectiveTol = breakStartMs === 0 ? Math.max(tol, 3e4) : tol;
|
|
7895
|
+
if (nowMs >= breakStartMs && (b.durationMs ? nowMs < end : nowMs <= breakStartMs + effectiveTol)) {
|
|
7855
7896
|
return b;
|
|
7856
7897
|
}
|
|
7857
7898
|
}
|