stormcloud-video-player 0.7.20 → 0.7.22
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 +67 -16
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +67 -16
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +3 -3
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.cjs +3 -3
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +3 -3
- package/lib/players/index.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +67 -16
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/utils/adcision.cjs +29 -0
- package/lib/utils/adcision.cjs.map +1 -1
- package/lib/utils/adcision.d.cts +9 -1
- package/package.json +1 -1
|
@@ -3030,7 +3030,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3030
3030
|
this.hls.on(import_hls.default.Events.FRAG_CHANGED, function(_evt, data) {
|
|
3031
3031
|
var frag = data === null || data === void 0 ? void 0 : data.frag;
|
|
3032
3032
|
if (!frag) return;
|
|
3033
|
-
if (_this.lastAdInsertionPoint && !_this.inAdBreak && _this.lastAdInsertionPoint.updated_at !== _this.processedAdInsertionUpdatedAt) {
|
|
3033
|
+
if (_this.lastAdInsertionPoint && !_this.inAdBreak && !_this.pendingAdBreak && _this.lastAdInsertionPoint.updated_at !== _this.processedAdInsertionUpdatedAt) {
|
|
3034
3034
|
var segmentName = _this.lastAdInsertionPoint.segment_ts_name;
|
|
3035
3035
|
if (_this.fragmentMatchesSegment(frag, segmentName)) {
|
|
3036
3036
|
var _ref;
|
|
@@ -3901,7 +3901,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3901
3901
|
]);
|
|
3902
3902
|
return [
|
|
3903
3903
|
4,
|
|
3904
|
-
fetch("https://adstorm.co/api-adstorm-dev/adstorm/
|
|
3904
|
+
fetch("https://adstorm.co/api-adstorm-dev/adstorm/adcision/channels/".concat(encodeURIComponent(this.config.projectId), "/ad-insertion-point"))
|
|
3905
3905
|
];
|
|
3906
3906
|
case 2:
|
|
3907
3907
|
resp = _state.sent();
|
|
@@ -3922,7 +3922,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3922
3922
|
this.pushAdInsertionDebug("api_response", data.segment_ts_name, {
|
|
3923
3923
|
offsetSeconds: data.offset_seconds,
|
|
3924
3924
|
updatedAt: data.updated_at,
|
|
3925
|
-
detail: "
|
|
3925
|
+
detail: "ch=".concat(data.channel_id, " id=").concat(data.id)
|
|
3926
3926
|
});
|
|
3927
3927
|
if (segmentChanged && (this.pendingAdBreak || this.adInsertionOffsetTimerId != null)) {
|
|
3928
3928
|
this.clearAdInsertionOffsetTimer();
|
|
@@ -7217,6 +7217,31 @@ function fetchAdcisionChannel(_0) {
|
|
|
7217
7217
|
});
|
|
7218
7218
|
}).apply(this, arguments);
|
|
7219
7219
|
}
|
|
7220
|
+
function fetchAdcisionChannelLiveContext(_0) {
|
|
7221
|
+
return _async_to_generator(function(channelId) {
|
|
7222
|
+
var apiBaseUrl, response;
|
|
7223
|
+
var _arguments = arguments;
|
|
7224
|
+
return _ts_generator(this, function(_state) {
|
|
7225
|
+
switch(_state.label){
|
|
7226
|
+
case 0:
|
|
7227
|
+
apiBaseUrl = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : ADCISION_API_BASE;
|
|
7228
|
+
return [
|
|
7229
|
+
4,
|
|
7230
|
+
fetch("".concat(apiBaseUrl, "/adstorm/adcision/channels/").concat(channelId, "/live-context"))
|
|
7231
|
+
];
|
|
7232
|
+
case 1:
|
|
7233
|
+
response = _state.sent();
|
|
7234
|
+
if (!response.ok) {
|
|
7235
|
+
throw new Error("Failed to fetch adcision channel live context ".concat(channelId, ": ").concat(response.status, " ").concat(response.statusText));
|
|
7236
|
+
}
|
|
7237
|
+
return [
|
|
7238
|
+
2,
|
|
7239
|
+
response.json()
|
|
7240
|
+
];
|
|
7241
|
+
}
|
|
7242
|
+
});
|
|
7243
|
+
}).apply(this, arguments);
|
|
7244
|
+
}
|
|
7220
7245
|
// src/ui/StormcloudVideoPlayer.tsx
|
|
7221
7246
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
7222
7247
|
var CRITICAL_PROPS = [
|
|
@@ -7503,7 +7528,8 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
|
|
|
7503
7528
|
licenseKey,
|
|
7504
7529
|
lowLatencyMode,
|
|
7505
7530
|
driftToleranceMs,
|
|
7506
|
-
adcisionChannelId
|
|
7531
|
+
adcisionChannelId,
|
|
7532
|
+
debugAdTiming
|
|
7507
7533
|
]);
|
|
7508
7534
|
(0, import_react2.useEffect)(function() {
|
|
7509
7535
|
if (typeof window === "undefined") return;
|
|
@@ -7836,13 +7862,13 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
|
|
|
7836
7862
|
adcisionChannelId
|
|
7837
7863
|
]);
|
|
7838
7864
|
(0, import_react2.useEffect)(function() {
|
|
7839
|
-
if (!showAiPanel || !swirlProjectId
|
|
7865
|
+
if (!showAiPanel || !swirlProjectId && !adcisionChannelId) return;
|
|
7840
7866
|
var cancelled = false;
|
|
7841
7867
|
var pollTimeoutId = null;
|
|
7842
7868
|
var inFlight = false;
|
|
7843
7869
|
var pollLiveContext = function pollLiveContext1() {
|
|
7844
7870
|
return _async_to_generator(function() {
|
|
7845
|
-
var
|
|
7871
|
+
var payload, adcisionCtx, response, error, message, _ref, _playerRef_current, segmentPollMs, nextPollMs;
|
|
7846
7872
|
return _ts_generator(this, function(_state) {
|
|
7847
7873
|
switch(_state.label){
|
|
7848
7874
|
case 0:
|
|
@@ -7860,10 +7886,32 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
|
|
|
7860
7886
|
case 1:
|
|
7861
7887
|
_state.trys.push([
|
|
7862
7888
|
1,
|
|
7889
|
+
7,
|
|
7890
|
+
8,
|
|
7891
|
+
9
|
|
7892
|
+
]);
|
|
7893
|
+
if (!adcisionChannelId) return [
|
|
7894
|
+
3,
|
|
7895
|
+
3
|
|
7896
|
+
];
|
|
7897
|
+
return [
|
|
7863
7898
|
4,
|
|
7864
|
-
|
|
7899
|
+
fetchAdcisionChannelLiveContext(adcisionChannelId)
|
|
7900
|
+
];
|
|
7901
|
+
case 2:
|
|
7902
|
+
adcisionCtx = _state.sent();
|
|
7903
|
+
payload = {
|
|
7904
|
+
id: adcisionCtx.id,
|
|
7905
|
+
project_id: adcisionCtx.channel_id,
|
|
7906
|
+
keywords: adcisionCtx.keywords,
|
|
7907
|
+
context: adcisionCtx.context,
|
|
7908
|
+
updated_at: adcisionCtx.updated_at
|
|
7909
|
+
};
|
|
7910
|
+
return [
|
|
7911
|
+
3,
|
|
7865
7912
|
6
|
|
7866
|
-
]
|
|
7913
|
+
];
|
|
7914
|
+
case 3:
|
|
7867
7915
|
return [
|
|
7868
7916
|
4,
|
|
7869
7917
|
fetch("https://adstorm.co/api-adstorm-dev/adstorm/swirl/projects/".concat(swirlProjectId, "/live-context"), {
|
|
@@ -7873,7 +7921,7 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
|
|
|
7873
7921
|
}
|
|
7874
7922
|
})
|
|
7875
7923
|
];
|
|
7876
|
-
case
|
|
7924
|
+
case 4:
|
|
7877
7925
|
response = _state.sent();
|
|
7878
7926
|
if (!response.ok) {
|
|
7879
7927
|
throw new Error("Live context request failed (".concat(response.status, " ").concat(response.statusText, ")"));
|
|
@@ -7882,8 +7930,10 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
|
|
|
7882
7930
|
4,
|
|
7883
7931
|
response.json()
|
|
7884
7932
|
];
|
|
7885
|
-
case
|
|
7933
|
+
case 5:
|
|
7886
7934
|
payload = _state.sent();
|
|
7935
|
+
_state.label = 6;
|
|
7936
|
+
case 6:
|
|
7887
7937
|
if (cancelled) return [
|
|
7888
7938
|
2
|
|
7889
7939
|
];
|
|
@@ -7895,9 +7945,9 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
|
|
|
7895
7945
|
});
|
|
7896
7946
|
return [
|
|
7897
7947
|
3,
|
|
7898
|
-
|
|
7948
|
+
9
|
|
7899
7949
|
];
|
|
7900
|
-
case
|
|
7950
|
+
case 7:
|
|
7901
7951
|
error = _state.sent();
|
|
7902
7952
|
if (cancelled) return [
|
|
7903
7953
|
2
|
|
@@ -7912,9 +7962,9 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
|
|
|
7912
7962
|
});
|
|
7913
7963
|
return [
|
|
7914
7964
|
3,
|
|
7915
|
-
|
|
7965
|
+
9
|
|
7916
7966
|
];
|
|
7917
|
-
case
|
|
7967
|
+
case 8:
|
|
7918
7968
|
inFlight = false;
|
|
7919
7969
|
if (!cancelled) {
|
|
7920
7970
|
;
|
|
@@ -7926,7 +7976,7 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
|
|
|
7926
7976
|
return [
|
|
7927
7977
|
7
|
|
7928
7978
|
];
|
|
7929
|
-
case
|
|
7979
|
+
case 9:
|
|
7930
7980
|
return [
|
|
7931
7981
|
2
|
|
7932
7982
|
];
|
|
@@ -7944,6 +7994,7 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
|
|
|
7944
7994
|
}, [
|
|
7945
7995
|
showAiPanel,
|
|
7946
7996
|
swirlProjectId,
|
|
7997
|
+
adcisionChannelId,
|
|
7947
7998
|
criticalPropsKey
|
|
7948
7999
|
]);
|
|
7949
8000
|
var handleWrapperMouseMove = (0, import_react2.useCallback)(function() {
|
|
@@ -8206,7 +8257,7 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
|
|
|
8206
8257
|
})
|
|
8207
8258
|
]
|
|
8208
8259
|
}),
|
|
8209
|
-
showAiPanel && !showLicenseWarning && swirlProjectId && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", {
|
|
8260
|
+
showAiPanel && !showLicenseWarning && (swirlProjectId || adcisionChannelId) && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", {
|
|
8210
8261
|
style: _object_spread_props(_object_spread({
|
|
8211
8262
|
position: "absolute",
|
|
8212
8263
|
right: "".concat(panelBaseRight, "px")
|