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
package/lib/players/index.cjs
CHANGED
|
@@ -2696,40 +2696,66 @@ function getBrowserID(clientInfo) {
|
|
|
2696
2696
|
});
|
|
2697
2697
|
})();
|
|
2698
2698
|
}
|
|
2699
|
-
|
|
2699
|
+
var PLAYER_TRACKING_BASE_URL = "https://adstorm.co/api-adstorm-dev/adstorm/player-tracking";
|
|
2700
|
+
var TRACK_URL = "".concat(PLAYER_TRACKING_BASE_URL, "/metrics/ingest");
|
|
2701
|
+
var HEARTBEAT_URL = "".concat(PLAYER_TRACKING_BASE_URL, "/heartbeat");
|
|
2702
|
+
var IMPRESSIONS_URL = "".concat(PLAYER_TRACKING_BASE_URL, "/impressions/ingest");
|
|
2703
|
+
function buildHeaders(licenseKey) {
|
|
2704
|
+
var headers = {
|
|
2705
|
+
"Content-Type": "application/json"
|
|
2706
|
+
};
|
|
2707
|
+
if (licenseKey) {
|
|
2708
|
+
headers["Authorization"] = "Bearer ".concat(licenseKey);
|
|
2709
|
+
}
|
|
2710
|
+
return headers;
|
|
2711
|
+
}
|
|
2712
|
+
function sendTrackRequest(licenseKey, body) {
|
|
2700
2713
|
return _async_to_generator(function() {
|
|
2701
|
-
var
|
|
2714
|
+
var response;
|
|
2702
2715
|
return _ts_generator(this, function(_state) {
|
|
2703
2716
|
switch(_state.label){
|
|
2704
2717
|
case 0:
|
|
2705
|
-
_state.trys.push([
|
|
2706
|
-
0,
|
|
2707
|
-
4,
|
|
2708
|
-
,
|
|
2709
|
-
5
|
|
2710
|
-
]);
|
|
2711
|
-
clientInfo = getClientInfo();
|
|
2712
2718
|
return [
|
|
2713
2719
|
4,
|
|
2714
|
-
|
|
2720
|
+
fetch(TRACK_URL, {
|
|
2721
|
+
method: "POST",
|
|
2722
|
+
headers: buildHeaders(licenseKey),
|
|
2723
|
+
body: JSON.stringify(body)
|
|
2724
|
+
})
|
|
2715
2725
|
];
|
|
2716
2726
|
case 1:
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
}
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2727
|
+
response = _state.sent();
|
|
2728
|
+
if (!response.ok) {
|
|
2729
|
+
throw new Error("HTTP error! status: ".concat(response.status));
|
|
2730
|
+
}
|
|
2731
|
+
return [
|
|
2732
|
+
4,
|
|
2733
|
+
response.json()
|
|
2734
|
+
];
|
|
2735
|
+
case 2:
|
|
2736
|
+
_state.sent();
|
|
2737
|
+
return [
|
|
2738
|
+
2
|
|
2739
|
+
];
|
|
2740
|
+
}
|
|
2741
|
+
});
|
|
2742
|
+
})();
|
|
2743
|
+
}
|
|
2744
|
+
function postJson(url, licenseKey, body) {
|
|
2745
|
+
return _async_to_generator(function() {
|
|
2746
|
+
var response;
|
|
2747
|
+
return _ts_generator(this, function(_state) {
|
|
2748
|
+
switch(_state.label){
|
|
2749
|
+
case 0:
|
|
2724
2750
|
return [
|
|
2725
2751
|
4,
|
|
2726
|
-
fetch(
|
|
2752
|
+
fetch(url, {
|
|
2727
2753
|
method: "POST",
|
|
2728
|
-
headers:
|
|
2729
|
-
body: JSON.stringify(
|
|
2754
|
+
headers: buildHeaders(licenseKey),
|
|
2755
|
+
body: JSON.stringify(body)
|
|
2730
2756
|
})
|
|
2731
2757
|
];
|
|
2732
|
-
case
|
|
2758
|
+
case 1:
|
|
2733
2759
|
response = _state.sent();
|
|
2734
2760
|
if (!response.ok) {
|
|
2735
2761
|
throw new Error("HTTP error! status: ".concat(response.status));
|
|
@@ -2738,35 +2764,63 @@ function sendInitialTracking(licenseKey) {
|
|
|
2738
2764
|
4,
|
|
2739
2765
|
response.json()
|
|
2740
2766
|
];
|
|
2741
|
-
case
|
|
2767
|
+
case 2:
|
|
2742
2768
|
_state.sent();
|
|
2743
2769
|
return [
|
|
2744
|
-
|
|
2745
|
-
5
|
|
2770
|
+
2
|
|
2746
2771
|
];
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2772
|
+
}
|
|
2773
|
+
});
|
|
2774
|
+
})();
|
|
2775
|
+
}
|
|
2776
|
+
function buildPlayerMetricEvent(_0) {
|
|
2777
|
+
return _async_to_generator(function(licenseKey) {
|
|
2778
|
+
var context, flags, _flags_captureAt, clientInfo, browserId, captureAt;
|
|
2779
|
+
var _arguments = arguments;
|
|
2780
|
+
return _ts_generator(this, function(_state) {
|
|
2781
|
+
switch(_state.label){
|
|
2782
|
+
case 0:
|
|
2783
|
+
context = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : {}, flags = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {};
|
|
2784
|
+
clientInfo = getClientInfo();
|
|
2750
2785
|
return [
|
|
2751
|
-
|
|
2752
|
-
|
|
2786
|
+
4,
|
|
2787
|
+
getBrowserID(clientInfo)
|
|
2753
2788
|
];
|
|
2754
|
-
case
|
|
2789
|
+
case 1:
|
|
2790
|
+
browserId = _state.sent();
|
|
2791
|
+
captureAt = (_flags_captureAt = flags.captureAt) !== null && _flags_captureAt !== void 0 ? _flags_captureAt : /* @__PURE__ */ new Date().toISOString();
|
|
2755
2792
|
return [
|
|
2756
|
-
2
|
|
2793
|
+
2,
|
|
2794
|
+
{
|
|
2795
|
+
player_id: browserId,
|
|
2796
|
+
browserId: browserId,
|
|
2797
|
+
device_type: clientInfo.deviceType,
|
|
2798
|
+
deviceType: clientInfo.deviceType,
|
|
2799
|
+
input_stream_type: context.inputStreamType,
|
|
2800
|
+
os: clientInfo.os,
|
|
2801
|
+
ad_loaded: flags.adLoaded,
|
|
2802
|
+
ad_detect: flags.adDetect,
|
|
2803
|
+
license_key: licenseKey,
|
|
2804
|
+
capture_at: captureAt,
|
|
2805
|
+
timestamp: captureAt
|
|
2806
|
+
}
|
|
2757
2807
|
];
|
|
2758
2808
|
}
|
|
2759
2809
|
});
|
|
2760
|
-
})();
|
|
2810
|
+
}).apply(this, arguments);
|
|
2761
2811
|
}
|
|
2762
|
-
function
|
|
2763
|
-
return _async_to_generator(function() {
|
|
2764
|
-
var clientInfo, browserId,
|
|
2812
|
+
function sendInitialTracking(_0) {
|
|
2813
|
+
return _async_to_generator(function(licenseKey) {
|
|
2814
|
+
var context, clientInfo, browserId, trackingData, error;
|
|
2815
|
+
var _arguments = arguments;
|
|
2765
2816
|
return _ts_generator(this, function(_state) {
|
|
2766
2817
|
switch(_state.label){
|
|
2767
2818
|
case 0:
|
|
2819
|
+
context = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : {};
|
|
2820
|
+
_state.label = 1;
|
|
2821
|
+
case 1:
|
|
2768
2822
|
_state.trys.push([
|
|
2769
|
-
|
|
2823
|
+
1,
|
|
2770
2824
|
4,
|
|
2771
2825
|
,
|
|
2772
2826
|
5
|
|
@@ -2776,35 +2830,29 @@ function sendHeartbeat(licenseKey) {
|
|
|
2776
2830
|
4,
|
|
2777
2831
|
getBrowserID(clientInfo)
|
|
2778
2832
|
];
|
|
2779
|
-
case
|
|
2833
|
+
case 2:
|
|
2780
2834
|
browserId = _state.sent();
|
|
2781
|
-
|
|
2782
|
-
browserId: browserId
|
|
2783
|
-
|
|
2784
|
-
};
|
|
2785
|
-
headers = {
|
|
2786
|
-
"Content-Type": "application/json"
|
|
2787
|
-
};
|
|
2788
|
-
if (licenseKey) {
|
|
2789
|
-
headers["Authorization"] = "Bearer ".concat(licenseKey);
|
|
2790
|
-
}
|
|
2835
|
+
trackingData = _object_spread({
|
|
2836
|
+
browserId: browserId
|
|
2837
|
+
}, clientInfo);
|
|
2791
2838
|
return [
|
|
2792
2839
|
4,
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2840
|
+
sendTrackRequest(licenseKey, {
|
|
2841
|
+
events: [
|
|
2842
|
+
{
|
|
2843
|
+
player_id: browserId,
|
|
2844
|
+
device_type: clientInfo.deviceType,
|
|
2845
|
+
input_stream_type: context.inputStreamType,
|
|
2846
|
+
os: clientInfo.os,
|
|
2847
|
+
ad_loaded: false,
|
|
2848
|
+
ad_detect: false,
|
|
2849
|
+
license_key: licenseKey,
|
|
2850
|
+
capture_at: /* @__PURE__ */ new Date().toISOString()
|
|
2851
|
+
}
|
|
2852
|
+
],
|
|
2853
|
+
trackingData: trackingData
|
|
2797
2854
|
})
|
|
2798
2855
|
];
|
|
2799
|
-
case 2:
|
|
2800
|
-
response = _state.sent();
|
|
2801
|
-
if (!response.ok) {
|
|
2802
|
-
throw new Error("HTTP error! status: ".concat(response.status));
|
|
2803
|
-
}
|
|
2804
|
-
return [
|
|
2805
|
-
4,
|
|
2806
|
-
response.json()
|
|
2807
|
-
];
|
|
2808
2856
|
case 3:
|
|
2809
2857
|
_state.sent();
|
|
2810
2858
|
return [
|
|
@@ -2813,7 +2861,7 @@ function sendHeartbeat(licenseKey) {
|
|
|
2813
2861
|
];
|
|
2814
2862
|
case 4:
|
|
2815
2863
|
error = _state.sent();
|
|
2816
|
-
console.error("[StormcloudVideoPlayer] Error sending
|
|
2864
|
+
console.error("[StormcloudVideoPlayer] Error sending initial tracking data:", error);
|
|
2817
2865
|
return [
|
|
2818
2866
|
3,
|
|
2819
2867
|
5
|
|
@@ -2824,95 +2872,74 @@ function sendHeartbeat(licenseKey) {
|
|
|
2824
2872
|
];
|
|
2825
2873
|
}
|
|
2826
2874
|
});
|
|
2827
|
-
})();
|
|
2875
|
+
}).apply(this, arguments);
|
|
2828
2876
|
}
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
}
|
|
2834
|
-
if (source === "preload" || source === "ssp") {
|
|
2835
|
-
return source === "ssp" ? "prebid" : "ima";
|
|
2836
|
-
}
|
|
2837
|
-
return adPlayerType === "hls" ? "hls" : "ima";
|
|
2838
|
-
}
|
|
2839
|
-
function postAdTracking(licenseKey, body) {
|
|
2840
|
-
return _async_to_generator(function() {
|
|
2841
|
-
var headers, response;
|
|
2877
|
+
function sendAdDetectTracking(_0, _1) {
|
|
2878
|
+
return _async_to_generator(function(licenseKey, adDetectInfo) {
|
|
2879
|
+
var context, error;
|
|
2880
|
+
var _arguments = arguments;
|
|
2842
2881
|
return _ts_generator(this, function(_state) {
|
|
2843
2882
|
switch(_state.label){
|
|
2844
2883
|
case 0:
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
};
|
|
2848
|
-
if (licenseKey) {
|
|
2849
|
-
headers["Authorization"] = "Bearer ".concat(licenseKey);
|
|
2850
|
-
}
|
|
2851
|
-
return [
|
|
2852
|
-
4,
|
|
2853
|
-
fetch(TRACK_API_URL, {
|
|
2854
|
-
method: "POST",
|
|
2855
|
-
headers: headers,
|
|
2856
|
-
body: JSON.stringify(body)
|
|
2857
|
-
})
|
|
2858
|
-
];
|
|
2884
|
+
context = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {};
|
|
2885
|
+
_state.label = 1;
|
|
2859
2886
|
case 1:
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2887
|
+
_state.trys.push([
|
|
2888
|
+
1,
|
|
2889
|
+
3,
|
|
2890
|
+
,
|
|
2891
|
+
4
|
|
2892
|
+
]);
|
|
2864
2893
|
return [
|
|
2865
2894
|
4,
|
|
2866
|
-
|
|
2895
|
+
sendHeartbeat(licenseKey, context, {
|
|
2896
|
+
adDetect: true,
|
|
2897
|
+
captureAt: adDetectInfo.timestamp
|
|
2898
|
+
})
|
|
2867
2899
|
];
|
|
2868
2900
|
case 2:
|
|
2869
2901
|
_state.sent();
|
|
2902
|
+
return [
|
|
2903
|
+
3,
|
|
2904
|
+
4
|
|
2905
|
+
];
|
|
2906
|
+
case 3:
|
|
2907
|
+
error = _state.sent();
|
|
2908
|
+
console.error("[StormcloudVideoPlayer] Error sending ad detect tracking:", error);
|
|
2909
|
+
return [
|
|
2910
|
+
3,
|
|
2911
|
+
4
|
|
2912
|
+
];
|
|
2913
|
+
case 4:
|
|
2870
2914
|
return [
|
|
2871
2915
|
2
|
|
2872
2916
|
];
|
|
2873
2917
|
}
|
|
2874
2918
|
});
|
|
2875
|
-
})();
|
|
2919
|
+
}).apply(this, arguments);
|
|
2876
2920
|
}
|
|
2877
|
-
function
|
|
2878
|
-
return _async_to_generator(function() {
|
|
2879
|
-
var
|
|
2921
|
+
function sendAdLoadedTracking(_0, _1) {
|
|
2922
|
+
return _async_to_generator(function(licenseKey, adLoadedInfo) {
|
|
2923
|
+
var context, error;
|
|
2924
|
+
var _arguments = arguments;
|
|
2880
2925
|
return _ts_generator(this, function(_state) {
|
|
2881
2926
|
switch(_state.label){
|
|
2882
2927
|
case 0:
|
|
2928
|
+
context = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {};
|
|
2929
|
+
_state.label = 1;
|
|
2930
|
+
case 1:
|
|
2883
2931
|
_state.trys.push([
|
|
2884
|
-
|
|
2932
|
+
1,
|
|
2885
2933
|
3,
|
|
2886
2934
|
,
|
|
2887
2935
|
4
|
|
2888
2936
|
]);
|
|
2889
|
-
clientInfo = getClientInfo();
|
|
2890
|
-
return [
|
|
2891
|
-
4,
|
|
2892
|
-
getBrowserID(clientInfo)
|
|
2893
|
-
];
|
|
2894
|
-
case 1:
|
|
2895
|
-
browserId = _state.sent();
|
|
2896
|
-
adDetectInfo = _object_spread({
|
|
2897
|
-
source: (_payload_source = payload.source) !== null && _payload_source !== void 0 ? _payload_source : "scte35",
|
|
2898
|
-
timestamp: (_payload_timestamp = payload.timestamp) !== null && _payload_timestamp !== void 0 ? _payload_timestamp : /* @__PURE__ */ new Date().toISOString()
|
|
2899
|
-
}, payload.durationSeconds != null && {
|
|
2900
|
-
durationSeconds: payload.durationSeconds
|
|
2901
|
-
}, payload.ptsSeconds != null && {
|
|
2902
|
-
ptsSeconds: payload.ptsSeconds
|
|
2903
|
-
}, payload.detectedAtFragmentSn != null && {
|
|
2904
|
-
detectedAtFragmentSn: payload.detectedAtFragmentSn
|
|
2905
|
-
});
|
|
2906
|
-
body = _object_spread_props(_object_spread({
|
|
2907
|
-
browserId: browserId
|
|
2908
|
-
}, clientInfo, licenseKey && {
|
|
2909
|
-
licenseKey: licenseKey
|
|
2910
|
-
}), {
|
|
2911
|
-
adDetectInfo: adDetectInfo
|
|
2912
|
-
});
|
|
2913
2937
|
return [
|
|
2914
2938
|
4,
|
|
2915
|
-
|
|
2939
|
+
sendHeartbeat(licenseKey, context, {
|
|
2940
|
+
adLoaded: true,
|
|
2941
|
+
captureAt: adLoadedInfo.timestamp
|
|
2942
|
+
})
|
|
2916
2943
|
];
|
|
2917
2944
|
case 2:
|
|
2918
2945
|
_state.sent();
|
|
@@ -2922,7 +2949,7 @@ function sendAdDetectTracking(licenseKey, payload) {
|
|
|
2922
2949
|
];
|
|
2923
2950
|
case 3:
|
|
2924
2951
|
error = _state.sent();
|
|
2925
|
-
console.error("[StormcloudVideoPlayer] Error sending ad
|
|
2952
|
+
console.error("[StormcloudVideoPlayer] Error sending ad loaded tracking:", error);
|
|
2926
2953
|
return [
|
|
2927
2954
|
3,
|
|
2928
2955
|
4
|
|
@@ -2933,126 +2960,116 @@ function sendAdDetectTracking(licenseKey, payload) {
|
|
|
2933
2960
|
];
|
|
2934
2961
|
}
|
|
2935
2962
|
});
|
|
2936
|
-
})();
|
|
2963
|
+
}).apply(this, arguments);
|
|
2937
2964
|
}
|
|
2938
|
-
function
|
|
2939
|
-
return _async_to_generator(function() {
|
|
2940
|
-
var
|
|
2965
|
+
function sendAdImpressionTracking(_0, _1) {
|
|
2966
|
+
return _async_to_generator(function(licenseKey, adImpressionInfo) {
|
|
2967
|
+
var context, metricEvent, error;
|
|
2968
|
+
var _arguments = arguments;
|
|
2941
2969
|
return _ts_generator(this, function(_state) {
|
|
2942
2970
|
switch(_state.label){
|
|
2943
2971
|
case 0:
|
|
2972
|
+
context = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {};
|
|
2973
|
+
_state.label = 1;
|
|
2974
|
+
case 1:
|
|
2944
2975
|
_state.trys.push([
|
|
2945
|
-
|
|
2946
|
-
|
|
2976
|
+
1,
|
|
2977
|
+
4,
|
|
2947
2978
|
,
|
|
2948
|
-
|
|
2979
|
+
5
|
|
2949
2980
|
]);
|
|
2950
|
-
clientInfo = getClientInfo();
|
|
2951
2981
|
return [
|
|
2952
2982
|
4,
|
|
2953
|
-
|
|
2983
|
+
buildPlayerMetricEvent(licenseKey, context, {
|
|
2984
|
+
captureAt: adImpressionInfo.timestamp
|
|
2985
|
+
})
|
|
2954
2986
|
];
|
|
2955
|
-
case
|
|
2956
|
-
|
|
2957
|
-
source = mapToAdTrackingSource(payload.source, adPlayerType);
|
|
2958
|
-
adLoadedInfo = _object_spread({
|
|
2959
|
-
source: source,
|
|
2960
|
-
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
2961
|
-
}, payload.vastUrl != null && {
|
|
2962
|
-
vastUrl: payload.vastUrl
|
|
2963
|
-
}, payload.durationSeconds != null && {
|
|
2964
|
-
durationSeconds: payload.durationSeconds
|
|
2965
|
-
});
|
|
2966
|
-
body = _object_spread_props(_object_spread({
|
|
2967
|
-
browserId: browserId
|
|
2968
|
-
}, clientInfo, licenseKey && {
|
|
2969
|
-
licenseKey: licenseKey
|
|
2970
|
-
}), {
|
|
2971
|
-
adLoadedInfo: adLoadedInfo
|
|
2972
|
-
});
|
|
2987
|
+
case 2:
|
|
2988
|
+
metricEvent = _state.sent();
|
|
2973
2989
|
return [
|
|
2974
2990
|
4,
|
|
2975
|
-
|
|
2991
|
+
Promise.all([
|
|
2992
|
+
postJson(HEARTBEAT_URL, licenseKey, metricEvent),
|
|
2993
|
+
postJson(IMPRESSIONS_URL, licenseKey, {
|
|
2994
|
+
events: [
|
|
2995
|
+
{
|
|
2996
|
+
player_id: metricEvent.player_id,
|
|
2997
|
+
ad_played_count: 1,
|
|
2998
|
+
ad_url: adImpressionInfo.adUrl,
|
|
2999
|
+
license_key: licenseKey,
|
|
3000
|
+
capture_at: adImpressionInfo.timestamp
|
|
3001
|
+
}
|
|
3002
|
+
]
|
|
3003
|
+
})
|
|
3004
|
+
])
|
|
2976
3005
|
];
|
|
2977
|
-
case
|
|
3006
|
+
case 3:
|
|
2978
3007
|
_state.sent();
|
|
2979
3008
|
return [
|
|
2980
3009
|
3,
|
|
2981
|
-
|
|
3010
|
+
5
|
|
2982
3011
|
];
|
|
2983
|
-
case
|
|
3012
|
+
case 4:
|
|
2984
3013
|
error = _state.sent();
|
|
2985
|
-
console.error("[StormcloudVideoPlayer] Error sending ad
|
|
3014
|
+
console.error("[StormcloudVideoPlayer] Error sending ad impression tracking:", error);
|
|
2986
3015
|
return [
|
|
2987
3016
|
3,
|
|
2988
|
-
|
|
3017
|
+
5
|
|
2989
3018
|
];
|
|
2990
|
-
case
|
|
3019
|
+
case 5:
|
|
2991
3020
|
return [
|
|
2992
3021
|
2
|
|
2993
3022
|
];
|
|
2994
3023
|
}
|
|
2995
3024
|
});
|
|
2996
|
-
})();
|
|
3025
|
+
}).apply(this, arguments);
|
|
2997
3026
|
}
|
|
2998
|
-
function
|
|
2999
|
-
return _async_to_generator(function() {
|
|
3000
|
-
var
|
|
3027
|
+
function sendHeartbeat(_0) {
|
|
3028
|
+
return _async_to_generator(function(licenseKey) {
|
|
3029
|
+
var context, flags, heartbeatData, error;
|
|
3030
|
+
var _arguments = arguments;
|
|
3001
3031
|
return _ts_generator(this, function(_state) {
|
|
3002
3032
|
switch(_state.label){
|
|
3003
3033
|
case 0:
|
|
3034
|
+
context = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : {}, flags = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {};
|
|
3035
|
+
_state.label = 1;
|
|
3036
|
+
case 1:
|
|
3004
3037
|
_state.trys.push([
|
|
3005
|
-
|
|
3006
|
-
|
|
3038
|
+
1,
|
|
3039
|
+
4,
|
|
3007
3040
|
,
|
|
3008
|
-
|
|
3041
|
+
5
|
|
3009
3042
|
]);
|
|
3010
|
-
clientInfo = getClientInfo();
|
|
3011
3043
|
return [
|
|
3012
3044
|
4,
|
|
3013
|
-
|
|
3045
|
+
buildPlayerMetricEvent(licenseKey, context, flags)
|
|
3014
3046
|
];
|
|
3015
|
-
case
|
|
3016
|
-
|
|
3017
|
-
source = mapToAdTrackingSource(payload.source, adPlayerType);
|
|
3018
|
-
adImpressionInfo = _object_spread({
|
|
3019
|
-
source: source,
|
|
3020
|
-
adIndex: payload.adIndex,
|
|
3021
|
-
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
3022
|
-
}, payload.durationSeconds != null && {
|
|
3023
|
-
durationSeconds: payload.durationSeconds
|
|
3024
|
-
});
|
|
3025
|
-
body = _object_spread_props(_object_spread({
|
|
3026
|
-
browserId: browserId
|
|
3027
|
-
}, clientInfo, licenseKey && {
|
|
3028
|
-
licenseKey: licenseKey
|
|
3029
|
-
}), {
|
|
3030
|
-
adImpressionInfo: adImpressionInfo
|
|
3031
|
-
});
|
|
3047
|
+
case 2:
|
|
3048
|
+
heartbeatData = _state.sent();
|
|
3032
3049
|
return [
|
|
3033
3050
|
4,
|
|
3034
|
-
|
|
3051
|
+
postJson(HEARTBEAT_URL, licenseKey, heartbeatData)
|
|
3035
3052
|
];
|
|
3036
|
-
case
|
|
3053
|
+
case 3:
|
|
3037
3054
|
_state.sent();
|
|
3038
3055
|
return [
|
|
3039
3056
|
3,
|
|
3040
|
-
|
|
3057
|
+
5
|
|
3041
3058
|
];
|
|
3042
|
-
case
|
|
3059
|
+
case 4:
|
|
3043
3060
|
error = _state.sent();
|
|
3044
|
-
console.error("[StormcloudVideoPlayer] Error sending
|
|
3061
|
+
console.error("[StormcloudVideoPlayer] Error sending heartbeat:", error);
|
|
3045
3062
|
return [
|
|
3046
3063
|
3,
|
|
3047
|
-
|
|
3064
|
+
5
|
|
3048
3065
|
];
|
|
3049
|
-
case
|
|
3066
|
+
case 5:
|
|
3050
3067
|
return [
|
|
3051
3068
|
2
|
|
3052
3069
|
];
|
|
3053
3070
|
}
|
|
3054
3071
|
});
|
|
3055
|
-
})();
|
|
3072
|
+
}).apply(this, arguments);
|
|
3056
3073
|
}
|
|
3057
3074
|
// src/utils/polyfills.ts
|
|
3058
3075
|
function polyfillURLSearchParams() {
|
|
@@ -3408,7 +3425,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3408
3425
|
key: "load",
|
|
3409
3426
|
value: function load() {
|
|
3410
3427
|
return _async_to_generator(function() {
|
|
3411
|
-
var _this, error, _this_config_lowLatencyMode, _this_video_play;
|
|
3428
|
+
var _this, error, _this_config_isLiveStream, _this_config_lowLatencyMode, _this_video_play;
|
|
3412
3429
|
return _ts_generator(this, function(_state) {
|
|
3413
3430
|
switch(_state.label){
|
|
3414
3431
|
case 0:
|
|
@@ -3452,7 +3469,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3452
3469
|
this.nativeHlsMode = true;
|
|
3453
3470
|
this.videoSrcProtection = this.config.src;
|
|
3454
3471
|
this.video.src = this.config.src;
|
|
3455
|
-
this.isLiveStream = (_this_config_lowLatencyMode = this.config.lowLatencyMode) !== null && _this_config_lowLatencyMode !== void 0 ? _this_config_lowLatencyMode : false;
|
|
3472
|
+
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;
|
|
3456
3473
|
if (this.config.debugAdTiming) {
|
|
3457
3474
|
console.log("[StormcloudVideoPlayer] Using native HLS playback - VOD mode:", {
|
|
3458
3475
|
isLive: this.isLiveStream,
|
|
@@ -3503,19 +3520,28 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3503
3520
|
});
|
|
3504
3521
|
this.hls.on(import_hls2.default.Events.MANIFEST_PARSED, function(_, data) {
|
|
3505
3522
|
return _async_to_generator(function() {
|
|
3506
|
-
var
|
|
3523
|
+
var _this_config_isLiveStream, _ref, _this_config_minSegmentsBeforePlay, _this_hls_levels, _this_hls, prerollKey, adBehavior, minSegments, _this_video_play;
|
|
3507
3524
|
return _ts_generator(this, function(_state) {
|
|
3508
3525
|
switch(_state.label){
|
|
3509
3526
|
case 0:
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3527
|
+
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) {
|
|
3528
|
+
var _level_details, _level_details1;
|
|
3529
|
+
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";
|
|
3530
|
+
})) !== null && _ref !== void 0 ? _ref : false;
|
|
3531
|
+
if (!this.isLiveStream && this.vmapBreaks.length === 0 && this.apiVastTagUrl) {
|
|
3532
|
+
prerollKey = "synthetic-vod-preroll";
|
|
3533
|
+
if (!this.consumedVmapBreakIds.has(prerollKey)) {
|
|
3534
|
+
this.vmapBreaks = [
|
|
3535
|
+
{
|
|
3536
|
+
id: prerollKey,
|
|
3537
|
+
startTimeMs: 0,
|
|
3538
|
+
vastTagUrl: this.apiVastTagUrl
|
|
3539
|
+
}
|
|
3540
|
+
];
|
|
3541
|
+
if (this.config.debugAdTiming) {
|
|
3542
|
+
console.log("[StormcloudVideoPlayer] Injected synthetic VOD preroll from apiVastTagUrl");
|
|
3543
|
+
}
|
|
3544
|
+
}
|
|
3519
3545
|
}
|
|
3520
3546
|
if (this.config.debugAdTiming) {
|
|
3521
3547
|
adBehavior = this.shouldContinueLiveStreamDuringAds() ? "live (main video continues muted during ads)" : "vod (main video pauses during ads)";
|
|
@@ -3845,8 +3871,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3845
3871
|
var _this = this;
|
|
3846
3872
|
this.ima.on("all_ads_completed", function() {
|
|
3847
3873
|
sendAdImpressionTracking(_this.config.licenseKey, {
|
|
3848
|
-
|
|
3849
|
-
|
|
3874
|
+
source: "ima",
|
|
3875
|
+
adIndex: _this.currentAdIndex,
|
|
3876
|
+
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
3877
|
+
}).catch(function() {});
|
|
3850
3878
|
var remaining = _this.getRemainingAdMs();
|
|
3851
3879
|
_this.consecutiveFailures = 0;
|
|
3852
3880
|
if (_this.config.debugAdTiming) {
|
|
@@ -3907,8 +3935,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3907
3935
|
});
|
|
3908
3936
|
this.ima.on("content_resume", function() {
|
|
3909
3937
|
sendAdImpressionTracking(_this.config.licenseKey, {
|
|
3910
|
-
|
|
3911
|
-
|
|
3938
|
+
source: "ima",
|
|
3939
|
+
adIndex: _this.currentAdIndex,
|
|
3940
|
+
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
3941
|
+
}).catch(function() {});
|
|
3912
3942
|
if (!_this.video.muted) {
|
|
3913
3943
|
_this.video.muted = true;
|
|
3914
3944
|
_this.video.volume = 0;
|
|
@@ -4542,7 +4572,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4542
4572
|
var detectPayload = {};
|
|
4543
4573
|
if (marker.durationSeconds != null) detectPayload.durationSeconds = marker.durationSeconds;
|
|
4544
4574
|
if (marker.ptsSeconds != null) detectPayload.ptsSeconds = marker.ptsSeconds;
|
|
4545
|
-
sendAdDetectTracking(this.config.licenseKey,
|
|
4575
|
+
sendAdDetectTracking(this.config.licenseKey, _object_spread({
|
|
4576
|
+
source: "scte35",
|
|
4577
|
+
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
4578
|
+
}, detectPayload)).catch(function() {});
|
|
4546
4579
|
}
|
|
4547
4580
|
var hasPrefetchedAds = this.pendingAdBreak && this.pendingAdBreak.vastUrls.length > 0;
|
|
4548
4581
|
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;
|
|
@@ -5784,7 +5817,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5784
5817
|
if (marker.durationSeconds != null) detectPayload.durationSeconds = marker.durationSeconds;
|
|
5785
5818
|
if (marker.ptsSeconds != null) detectPayload.ptsSeconds = marker.ptsSeconds;
|
|
5786
5819
|
if (fragmentSn !== void 0) detectPayload.detectedAtFragmentSn = fragmentSn;
|
|
5787
|
-
sendAdDetectTracking(this.config.licenseKey,
|
|
5820
|
+
sendAdDetectTracking(this.config.licenseKey, _object_spread({
|
|
5821
|
+
source: "scte35",
|
|
5822
|
+
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
5823
|
+
}, detectPayload)).catch(function() {});
|
|
5788
5824
|
if (this.config.debugAdTiming) {
|
|
5789
5825
|
console.log("[PREFETCH] \uD83D\uDD04 Starting ad prefetch for upcoming ad break");
|
|
5790
5826
|
console.log("[PREFETCH] \uD83D\uDCCB Pre-generated ".concat(generatedUrls.length, " VAST URLs"));
|
|
@@ -6265,9 +6301,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6265
6301
|
preloadedController = preloaded.imaController;
|
|
6266
6302
|
usePreloadedAd = true;
|
|
6267
6303
|
sendAdLoadedTracking(this.config.licenseKey, {
|
|
6268
|
-
source: "
|
|
6269
|
-
vastUrl: firstAdUrl
|
|
6270
|
-
|
|
6304
|
+
source: "ima",
|
|
6305
|
+
vastUrl: firstAdUrl,
|
|
6306
|
+
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
6307
|
+
}).catch(function() {});
|
|
6271
6308
|
if (this.config.debugAdTiming) {
|
|
6272
6309
|
console.log("[CONTINUOUS-FETCH] \uD83D\uDE80 Using preloaded ad from pool (preloaded in advance, ready immediately!)");
|
|
6273
6310
|
console.log("[CONTINUOUS-FETCH] Pool still has ".concat(this.preloadPool.length, " preloaded ads ready"));
|
|
@@ -6357,9 +6394,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6357
6394
|
case 5:
|
|
6358
6395
|
_state.sent();
|
|
6359
6396
|
sendAdLoadedTracking(this.config.licenseKey, {
|
|
6360
|
-
source: "
|
|
6361
|
-
vastUrl: firstAdUrl
|
|
6362
|
-
|
|
6397
|
+
source: "ima",
|
|
6398
|
+
vastUrl: firstAdUrl,
|
|
6399
|
+
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
6400
|
+
}).catch(function() {});
|
|
6363
6401
|
if (this.config.debugAdTiming) {
|
|
6364
6402
|
console.log("[CONTINUOUS-FETCH] \u2705 First ad request successful, starting playback");
|
|
6365
6403
|
}
|
|
@@ -6755,9 +6793,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6755
6793
|
console.log("[CONTINUOUS-FETCH] \uD83C\uDFAF Using preloaded ad from pool (".concat(this.preloadPool.length, " remaining in pool)"));
|
|
6756
6794
|
}
|
|
6757
6795
|
sendAdLoadedTracking(this.config.licenseKey, {
|
|
6758
|
-
source: "
|
|
6759
|
-
vastUrl: preloaded.vastUrl
|
|
6760
|
-
|
|
6796
|
+
source: "ima",
|
|
6797
|
+
vastUrl: preloaded.vastUrl,
|
|
6798
|
+
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
6799
|
+
}).catch(function() {});
|
|
6761
6800
|
_state.label = 1;
|
|
6762
6801
|
case 1:
|
|
6763
6802
|
_state.trys.push([
|
|
@@ -7509,9 +7548,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7509
7548
|
case 3:
|
|
7510
7549
|
_state.sent();
|
|
7511
7550
|
sendAdLoadedTracking(this.config.licenseKey, {
|
|
7512
|
-
source: "
|
|
7513
|
-
vastUrl: vastTagUrl
|
|
7514
|
-
|
|
7551
|
+
source: "ima",
|
|
7552
|
+
vastUrl: vastTagUrl,
|
|
7553
|
+
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
7554
|
+
}).catch(function() {});
|
|
7515
7555
|
this.clearAdRequestWatchdog();
|
|
7516
7556
|
if (this.activeAdRequestToken !== requestToken) {
|
|
7517
7557
|
return [
|
|
@@ -7939,7 +7979,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7939
7979
|
continue;
|
|
7940
7980
|
}
|
|
7941
7981
|
var end = breakStartMs + (b.durationMs || 0);
|
|
7942
|
-
|
|
7982
|
+
var effectiveTol = breakStartMs === 0 ? Math.max(tol, 3e4) : tol;
|
|
7983
|
+
if (nowMs >= breakStartMs && (b.durationMs ? nowMs < end : nowMs <= breakStartMs + effectiveTol)) {
|
|
7943
7984
|
return b;
|
|
7944
7985
|
}
|
|
7945
7986
|
}
|