stormcloud-video-player 0.5.12 → 0.5.13
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 +57 -25
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +1 -3
- package/lib/index.d.ts +1 -3
- package/lib/index.js +57 -25
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +57 -25
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +1 -3
- package/lib/players/FilePlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.cjs +57 -25
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +57 -25
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/prebidAdLayer.cjs.map +1 -1
- package/lib/sdk/vastParser.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +57 -25
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/utils/browserCompat.cjs.map +1 -1
- package/lib/utils/polyfills.cjs.map +1 -1
- package/lib/utils/tracking.cjs.map +1 -1
- package/package.json +1 -1
|
@@ -2551,18 +2551,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
2551
2551
|
this.bufferedSegmentsCount = 0;
|
|
2552
2552
|
this.shouldAutoplayAfterBuffering = false;
|
|
2553
2553
|
this.hasInitialBufferCompleted = false;
|
|
2554
|
-
this.adRequestTokenCounter = 0;
|
|
2555
2554
|
this.activeAdRequestToken = null;
|
|
2556
2555
|
this.adRequestWatchdogToken = null;
|
|
2557
2556
|
this.adFailsafeToken = null;
|
|
2558
2557
|
this.continuousFetchingActive = false;
|
|
2559
|
-
this.adRequestQueue = [];
|
|
2560
2558
|
this.maxPlaceholderDurationMs = 5e3;
|
|
2561
2559
|
this.isShowingPlaceholder = false;
|
|
2562
2560
|
this.totalAdRequestsInBreak = 0;
|
|
2563
2561
|
this.maxTotalAdRequestsPerBreak = 20;
|
|
2564
2562
|
this.pendingAdBreak = null;
|
|
2565
|
-
this.prefetchAdPromise = null;
|
|
2566
2563
|
this.savedMutedStateBeforeScte = null;
|
|
2567
2564
|
this.consecutiveFailures = 0;
|
|
2568
2565
|
this.maxConsecutiveFailures = 5;
|
|
@@ -2570,6 +2567,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
2570
2567
|
this.minAdRequestIntervalMs = 2500;
|
|
2571
2568
|
this.backoffBaseMs = 1e3;
|
|
2572
2569
|
this.maxBackoffMs = 15e3;
|
|
2570
|
+
this.adTransitionGapMs = 1500;
|
|
2573
2571
|
initializePolyfills();
|
|
2574
2572
|
var browserOverrides = getBrowserConfigOverrides();
|
|
2575
2573
|
this.config = _object_spread({}, browserOverrides, config);
|
|
@@ -3096,7 +3094,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3096
3094
|
if (_this.config.debugAdTiming) console.warn("[StormcloudVideoPlayer] playAd(pending) failed:", err);
|
|
3097
3095
|
_this.handleAdFailure();
|
|
3098
3096
|
});
|
|
3099
|
-
},
|
|
3097
|
+
}, _this.adTransitionGapMs);
|
|
3100
3098
|
return;
|
|
3101
3099
|
}
|
|
3102
3100
|
if (remaining <= 500 && _this.expectedAdBreakDurationMs != null) {
|
|
@@ -3876,7 +3874,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3876
3874
|
isFetching: false,
|
|
3877
3875
|
fetchStartTime: Date.now()
|
|
3878
3876
|
});
|
|
3879
|
-
|
|
3877
|
+
void this.adRequest().then(function() {}).catch(function() {
|
|
3880
3878
|
if (_this.config.debugAdTiming) {
|
|
3881
3879
|
console.log("[PREFETCH] Prebid auction prefetch failed, will request at playback time");
|
|
3882
3880
|
}
|
|
@@ -3893,7 +3891,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3893
3891
|
clearTimeout(this.prefetchTimerId);
|
|
3894
3892
|
this.prefetchTimerId = void 0;
|
|
3895
3893
|
}
|
|
3896
|
-
this.prefetchAdPromise = null;
|
|
3897
3894
|
this.pendingAdBreak = null;
|
|
3898
3895
|
}
|
|
3899
3896
|
},
|
|
@@ -3921,6 +3918,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3921
3918
|
2,
|
|
3922
3919
|
"break"
|
|
3923
3920
|
];
|
|
3921
|
+
if (_this.totalAdRequestsInBreak >= _this.maxTotalAdRequestsPerBreak) return [
|
|
3922
|
+
2,
|
|
3923
|
+
"break"
|
|
3924
|
+
];
|
|
3924
3925
|
delay = _this.lastAdRequestTime ? _this.minAdRequestIntervalMs + (_this.consecutiveFailures > 0 ? backoffMs() : 0) : 0;
|
|
3925
3926
|
elapsed = Date.now() - _this.lastAdRequestTime;
|
|
3926
3927
|
if (!(elapsed < delay && _this.lastAdRequestTime > 0)) return [
|
|
@@ -4114,14 +4115,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4114
4115
|
this.expectedAdBreakDurationMs = adBreakDurationMs;
|
|
4115
4116
|
}
|
|
4116
4117
|
this.clearPendingAdBreak();
|
|
4117
|
-
this.startContinuousFetchLoop();
|
|
4118
4118
|
_state.label = 1;
|
|
4119
4119
|
case 1:
|
|
4120
4120
|
_state.trys.push([
|
|
4121
4121
|
1,
|
|
4122
|
-
|
|
4122
|
+
7,
|
|
4123
4123
|
,
|
|
4124
|
-
|
|
4124
|
+
9
|
|
4125
4125
|
]);
|
|
4126
4126
|
this.lastAdRequestTime = Date.now();
|
|
4127
4127
|
return [
|
|
@@ -4161,27 +4161,40 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4161
4161
|
this.adLayer.setAdVolume(adVolume);
|
|
4162
4162
|
return [
|
|
4163
4163
|
3,
|
|
4164
|
-
|
|
4164
|
+
6
|
|
4165
4165
|
];
|
|
4166
4166
|
case 4:
|
|
4167
4167
|
this.consecutiveFailures++;
|
|
4168
|
-
|
|
4168
|
+
return [
|
|
4169
|
+
4,
|
|
4170
|
+
this.showPlaceholderAndWaitForAds()
|
|
4171
|
+
];
|
|
4169
4172
|
case 5:
|
|
4173
|
+
_state.sent();
|
|
4174
|
+
_state.label = 6;
|
|
4175
|
+
case 6:
|
|
4170
4176
|
return [
|
|
4171
4177
|
3,
|
|
4172
|
-
|
|
4178
|
+
9
|
|
4173
4179
|
];
|
|
4174
|
-
case
|
|
4180
|
+
case 7:
|
|
4175
4181
|
error = _state.sent();
|
|
4176
4182
|
if (this.config.debugAdTiming) {
|
|
4177
4183
|
console.warn("[CONTINUOUS-FETCH] \u26A0\uFE0F First ad request failed:", error);
|
|
4178
4184
|
}
|
|
4179
4185
|
this.consecutiveFailures++;
|
|
4186
|
+
return [
|
|
4187
|
+
4,
|
|
4188
|
+
this.showPlaceholderAndWaitForAds()
|
|
4189
|
+
];
|
|
4190
|
+
case 8:
|
|
4191
|
+
_state.sent();
|
|
4180
4192
|
return [
|
|
4181
4193
|
3,
|
|
4182
|
-
|
|
4194
|
+
9
|
|
4183
4195
|
];
|
|
4184
|
-
case
|
|
4196
|
+
case 9:
|
|
4197
|
+
this.startContinuousFetchLoop();
|
|
4185
4198
|
return [
|
|
4186
4199
|
2
|
|
4187
4200
|
];
|
|
@@ -4257,6 +4270,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4257
4270
|
return _ts_generator(this, function(_state) {
|
|
4258
4271
|
switch(_state.label){
|
|
4259
4272
|
case 0:
|
|
4273
|
+
if (this.totalAdRequestsInBreak >= this.maxTotalAdRequestsPerBreak) {
|
|
4274
|
+
if (this.config.debugAdTiming) {
|
|
4275
|
+
console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 Max ad requests per break (".concat(this.maxTotalAdRequestsPerBreak, ") reached"));
|
|
4276
|
+
}
|
|
4277
|
+
this.handleAdPodComplete();
|
|
4278
|
+
return [
|
|
4279
|
+
2
|
|
4280
|
+
];
|
|
4281
|
+
}
|
|
4260
4282
|
remaining = this.getRemainingAdMs();
|
|
4261
4283
|
if (remaining <= 500 && this.expectedAdBreakDurationMs != null) {
|
|
4262
4284
|
if (this.config.debugAdTiming) {
|
|
@@ -4280,9 +4302,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4280
4302
|
case 1:
|
|
4281
4303
|
_state.trys.push([
|
|
4282
4304
|
1,
|
|
4283
|
-
|
|
4305
|
+
9,
|
|
4284
4306
|
,
|
|
4285
|
-
|
|
4307
|
+
11
|
|
4286
4308
|
]);
|
|
4287
4309
|
this.lastAdRequestTime = Date.now();
|
|
4288
4310
|
return [
|
|
@@ -4331,27 +4353,39 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4331
4353
|
case 5:
|
|
4332
4354
|
return [
|
|
4333
4355
|
3,
|
|
4334
|
-
|
|
4356
|
+
8
|
|
4335
4357
|
];
|
|
4336
4358
|
case 6:
|
|
4337
4359
|
this.consecutiveFailures++;
|
|
4338
|
-
|
|
4360
|
+
return [
|
|
4361
|
+
4,
|
|
4362
|
+
this.showPlaceholderAndWaitForAds()
|
|
4363
|
+
];
|
|
4339
4364
|
case 7:
|
|
4365
|
+
_state.sent();
|
|
4366
|
+
_state.label = 8;
|
|
4367
|
+
case 8:
|
|
4340
4368
|
return [
|
|
4341
4369
|
3,
|
|
4342
|
-
|
|
4370
|
+
11
|
|
4343
4371
|
];
|
|
4344
|
-
case
|
|
4372
|
+
case 9:
|
|
4345
4373
|
error = _state.sent();
|
|
4346
4374
|
this.consecutiveFailures++;
|
|
4347
4375
|
if (this.config.debugAdTiming) {
|
|
4348
4376
|
console.warn("[CONTINUOUS-FETCH] tryNextAvailableAd request failed:", error);
|
|
4349
4377
|
}
|
|
4378
|
+
return [
|
|
4379
|
+
4,
|
|
4380
|
+
this.showPlaceholderAndWaitForAds()
|
|
4381
|
+
];
|
|
4382
|
+
case 10:
|
|
4383
|
+
_state.sent();
|
|
4350
4384
|
return [
|
|
4351
4385
|
3,
|
|
4352
|
-
|
|
4386
|
+
11
|
|
4353
4387
|
];
|
|
4354
|
-
case
|
|
4388
|
+
case 11:
|
|
4355
4389
|
return [
|
|
4356
4390
|
2
|
|
4357
4391
|
];
|
|
@@ -4427,7 +4461,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4427
4461
|
this.pendingNextAdBids = null;
|
|
4428
4462
|
this.isShowingPlaceholder = false;
|
|
4429
4463
|
this.adLayer.hidePlaceholder();
|
|
4430
|
-
this.adLayer.updateOriginalMutedState(this.video.muted, this.video.volume);
|
|
4431
4464
|
this.currentAdIndex++;
|
|
4432
4465
|
_state.label = 3;
|
|
4433
4466
|
case 3:
|
|
@@ -4981,7 +5014,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4981
5014
|
}
|
|
4982
5015
|
(_this_hls = this.hls) === null || _this_hls === void 0 ? void 0 : _this_hls.destroy();
|
|
4983
5016
|
(_this_adLayer = this.adLayer) === null || _this_adLayer === void 0 ? void 0 : _this_adLayer.destroy();
|
|
4984
|
-
this.adRequestQueue = [];
|
|
4985
5017
|
this.consecutiveFailures = 0;
|
|
4986
5018
|
}
|
|
4987
5019
|
}
|