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
package/lib/index.js
CHANGED
|
@@ -3042,7 +3042,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3042
3042
|
this.hls.on(Hls.Events.FRAG_CHANGED, function(_evt, data) {
|
|
3043
3043
|
var frag = data === null || data === void 0 ? void 0 : data.frag;
|
|
3044
3044
|
if (!frag) return;
|
|
3045
|
-
if (_this.lastAdInsertionPoint && !_this.inAdBreak && _this.lastAdInsertionPoint.updated_at !== _this.processedAdInsertionUpdatedAt) {
|
|
3045
|
+
if (_this.lastAdInsertionPoint && !_this.inAdBreak && !_this.pendingAdBreak && _this.lastAdInsertionPoint.updated_at !== _this.processedAdInsertionUpdatedAt) {
|
|
3046
3046
|
var segmentName = _this.lastAdInsertionPoint.segment_ts_name;
|
|
3047
3047
|
if (_this.fragmentMatchesSegment(frag, segmentName)) {
|
|
3048
3048
|
var _ref;
|
|
@@ -3913,7 +3913,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3913
3913
|
]);
|
|
3914
3914
|
return [
|
|
3915
3915
|
4,
|
|
3916
|
-
fetch("https://adstorm.co/api-adstorm-dev/adstorm/
|
|
3916
|
+
fetch("https://adstorm.co/api-adstorm-dev/adstorm/adcision/channels/".concat(encodeURIComponent(this.config.projectId), "/ad-insertion-point"))
|
|
3917
3917
|
];
|
|
3918
3918
|
case 2:
|
|
3919
3919
|
resp = _state.sent();
|
|
@@ -3934,7 +3934,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3934
3934
|
this.pushAdInsertionDebug("api_response", data.segment_ts_name, {
|
|
3935
3935
|
offsetSeconds: data.offset_seconds,
|
|
3936
3936
|
updatedAt: data.updated_at,
|
|
3937
|
-
detail: "
|
|
3937
|
+
detail: "ch=".concat(data.channel_id, " id=").concat(data.id)
|
|
3938
3938
|
});
|
|
3939
3939
|
if (segmentChanged && (this.pendingAdBreak || this.adInsertionOffsetTimerId != null)) {
|
|
3940
3940
|
this.clearAdInsertionOffsetTimer();
|
|
@@ -7229,6 +7229,31 @@ function fetchAdcisionChannel(_0) {
|
|
|
7229
7229
|
});
|
|
7230
7230
|
}).apply(this, arguments);
|
|
7231
7231
|
}
|
|
7232
|
+
function fetchAdcisionChannelLiveContext(_0) {
|
|
7233
|
+
return _async_to_generator(function(channelId) {
|
|
7234
|
+
var apiBaseUrl, response;
|
|
7235
|
+
var _arguments = arguments;
|
|
7236
|
+
return _ts_generator(this, function(_state) {
|
|
7237
|
+
switch(_state.label){
|
|
7238
|
+
case 0:
|
|
7239
|
+
apiBaseUrl = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : ADCISION_API_BASE;
|
|
7240
|
+
return [
|
|
7241
|
+
4,
|
|
7242
|
+
fetch("".concat(apiBaseUrl, "/adstorm/adcision/channels/").concat(channelId, "/live-context"))
|
|
7243
|
+
];
|
|
7244
|
+
case 1:
|
|
7245
|
+
response = _state.sent();
|
|
7246
|
+
if (!response.ok) {
|
|
7247
|
+
throw new Error("Failed to fetch adcision channel live context ".concat(channelId, ": ").concat(response.status, " ").concat(response.statusText));
|
|
7248
|
+
}
|
|
7249
|
+
return [
|
|
7250
|
+
2,
|
|
7251
|
+
response.json()
|
|
7252
|
+
];
|
|
7253
|
+
}
|
|
7254
|
+
});
|
|
7255
|
+
}).apply(this, arguments);
|
|
7256
|
+
}
|
|
7232
7257
|
// src/ui/StormcloudVideoPlayer.tsx
|
|
7233
7258
|
import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
7234
7259
|
var CRITICAL_PROPS = [
|
|
@@ -7515,7 +7540,8 @@ var StormcloudVideoPlayerComponent = React2.memo(function(props) {
|
|
|
7515
7540
|
licenseKey,
|
|
7516
7541
|
lowLatencyMode,
|
|
7517
7542
|
driftToleranceMs,
|
|
7518
|
-
adcisionChannelId
|
|
7543
|
+
adcisionChannelId,
|
|
7544
|
+
debugAdTiming
|
|
7519
7545
|
]);
|
|
7520
7546
|
useEffect2(function() {
|
|
7521
7547
|
if (typeof window === "undefined") return;
|
|
@@ -7848,13 +7874,13 @@ var StormcloudVideoPlayerComponent = React2.memo(function(props) {
|
|
|
7848
7874
|
adcisionChannelId
|
|
7849
7875
|
]);
|
|
7850
7876
|
useEffect2(function() {
|
|
7851
|
-
if (!showAiPanel || !swirlProjectId
|
|
7877
|
+
if (!showAiPanel || !swirlProjectId && !adcisionChannelId) return;
|
|
7852
7878
|
var cancelled = false;
|
|
7853
7879
|
var pollTimeoutId = null;
|
|
7854
7880
|
var inFlight = false;
|
|
7855
7881
|
var pollLiveContext = function pollLiveContext1() {
|
|
7856
7882
|
return _async_to_generator(function() {
|
|
7857
|
-
var
|
|
7883
|
+
var payload, adcisionCtx, response, error, message, _ref, _playerRef_current, segmentPollMs, nextPollMs;
|
|
7858
7884
|
return _ts_generator(this, function(_state) {
|
|
7859
7885
|
switch(_state.label){
|
|
7860
7886
|
case 0:
|
|
@@ -7872,10 +7898,32 @@ var StormcloudVideoPlayerComponent = React2.memo(function(props) {
|
|
|
7872
7898
|
case 1:
|
|
7873
7899
|
_state.trys.push([
|
|
7874
7900
|
1,
|
|
7901
|
+
7,
|
|
7902
|
+
8,
|
|
7903
|
+
9
|
|
7904
|
+
]);
|
|
7905
|
+
if (!adcisionChannelId) return [
|
|
7906
|
+
3,
|
|
7907
|
+
3
|
|
7908
|
+
];
|
|
7909
|
+
return [
|
|
7875
7910
|
4,
|
|
7876
|
-
|
|
7911
|
+
fetchAdcisionChannelLiveContext(adcisionChannelId)
|
|
7912
|
+
];
|
|
7913
|
+
case 2:
|
|
7914
|
+
adcisionCtx = _state.sent();
|
|
7915
|
+
payload = {
|
|
7916
|
+
id: adcisionCtx.id,
|
|
7917
|
+
project_id: adcisionCtx.channel_id,
|
|
7918
|
+
keywords: adcisionCtx.keywords,
|
|
7919
|
+
context: adcisionCtx.context,
|
|
7920
|
+
updated_at: adcisionCtx.updated_at
|
|
7921
|
+
};
|
|
7922
|
+
return [
|
|
7923
|
+
3,
|
|
7877
7924
|
6
|
|
7878
|
-
]
|
|
7925
|
+
];
|
|
7926
|
+
case 3:
|
|
7879
7927
|
return [
|
|
7880
7928
|
4,
|
|
7881
7929
|
fetch("https://adstorm.co/api-adstorm-dev/adstorm/swirl/projects/".concat(swirlProjectId, "/live-context"), {
|
|
@@ -7885,7 +7933,7 @@ var StormcloudVideoPlayerComponent = React2.memo(function(props) {
|
|
|
7885
7933
|
}
|
|
7886
7934
|
})
|
|
7887
7935
|
];
|
|
7888
|
-
case
|
|
7936
|
+
case 4:
|
|
7889
7937
|
response = _state.sent();
|
|
7890
7938
|
if (!response.ok) {
|
|
7891
7939
|
throw new Error("Live context request failed (".concat(response.status, " ").concat(response.statusText, ")"));
|
|
@@ -7894,8 +7942,10 @@ var StormcloudVideoPlayerComponent = React2.memo(function(props) {
|
|
|
7894
7942
|
4,
|
|
7895
7943
|
response.json()
|
|
7896
7944
|
];
|
|
7897
|
-
case
|
|
7945
|
+
case 5:
|
|
7898
7946
|
payload = _state.sent();
|
|
7947
|
+
_state.label = 6;
|
|
7948
|
+
case 6:
|
|
7899
7949
|
if (cancelled) return [
|
|
7900
7950
|
2
|
|
7901
7951
|
];
|
|
@@ -7907,9 +7957,9 @@ var StormcloudVideoPlayerComponent = React2.memo(function(props) {
|
|
|
7907
7957
|
});
|
|
7908
7958
|
return [
|
|
7909
7959
|
3,
|
|
7910
|
-
|
|
7960
|
+
9
|
|
7911
7961
|
];
|
|
7912
|
-
case
|
|
7962
|
+
case 7:
|
|
7913
7963
|
error = _state.sent();
|
|
7914
7964
|
if (cancelled) return [
|
|
7915
7965
|
2
|
|
@@ -7924,9 +7974,9 @@ var StormcloudVideoPlayerComponent = React2.memo(function(props) {
|
|
|
7924
7974
|
});
|
|
7925
7975
|
return [
|
|
7926
7976
|
3,
|
|
7927
|
-
|
|
7977
|
+
9
|
|
7928
7978
|
];
|
|
7929
|
-
case
|
|
7979
|
+
case 8:
|
|
7930
7980
|
inFlight = false;
|
|
7931
7981
|
if (!cancelled) {
|
|
7932
7982
|
;
|
|
@@ -7938,7 +7988,7 @@ var StormcloudVideoPlayerComponent = React2.memo(function(props) {
|
|
|
7938
7988
|
return [
|
|
7939
7989
|
7
|
|
7940
7990
|
];
|
|
7941
|
-
case
|
|
7991
|
+
case 9:
|
|
7942
7992
|
return [
|
|
7943
7993
|
2
|
|
7944
7994
|
];
|
|
@@ -7956,6 +8006,7 @@ var StormcloudVideoPlayerComponent = React2.memo(function(props) {
|
|
|
7956
8006
|
}, [
|
|
7957
8007
|
showAiPanel,
|
|
7958
8008
|
swirlProjectId,
|
|
8009
|
+
adcisionChannelId,
|
|
7959
8010
|
criticalPropsKey
|
|
7960
8011
|
]);
|
|
7961
8012
|
var handleWrapperMouseMove = useCallback2(function() {
|
|
@@ -8218,7 +8269,7 @@ var StormcloudVideoPlayerComponent = React2.memo(function(props) {
|
|
|
8218
8269
|
})
|
|
8219
8270
|
]
|
|
8220
8271
|
}),
|
|
8221
|
-
showAiPanel && !showLicenseWarning && swirlProjectId && /* @__PURE__ */ jsxs2("div", {
|
|
8272
|
+
showAiPanel && !showLicenseWarning && (swirlProjectId || adcisionChannelId) && /* @__PURE__ */ jsxs2("div", {
|
|
8222
8273
|
style: _object_spread_props(_object_spread({
|
|
8223
8274
|
position: "absolute",
|
|
8224
8275
|
right: "".concat(panelBaseRight, "px")
|