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
package/lib/players/index.cjs
CHANGED
|
@@ -2601,18 +2601,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
2601
2601
|
this.bufferedSegmentsCount = 0;
|
|
2602
2602
|
this.shouldAutoplayAfterBuffering = false;
|
|
2603
2603
|
this.hasInitialBufferCompleted = false;
|
|
2604
|
-
this.adRequestTokenCounter = 0;
|
|
2605
2604
|
this.activeAdRequestToken = null;
|
|
2606
2605
|
this.adRequestWatchdogToken = null;
|
|
2607
2606
|
this.adFailsafeToken = null;
|
|
2608
2607
|
this.continuousFetchingActive = false;
|
|
2609
|
-
this.adRequestQueue = [];
|
|
2610
2608
|
this.maxPlaceholderDurationMs = 5e3;
|
|
2611
2609
|
this.isShowingPlaceholder = false;
|
|
2612
2610
|
this.totalAdRequestsInBreak = 0;
|
|
2613
2611
|
this.maxTotalAdRequestsPerBreak = 20;
|
|
2614
2612
|
this.pendingAdBreak = null;
|
|
2615
|
-
this.prefetchAdPromise = null;
|
|
2616
2613
|
this.savedMutedStateBeforeScte = null;
|
|
2617
2614
|
this.consecutiveFailures = 0;
|
|
2618
2615
|
this.maxConsecutiveFailures = 5;
|
|
@@ -2620,6 +2617,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
2620
2617
|
this.minAdRequestIntervalMs = 2500;
|
|
2621
2618
|
this.backoffBaseMs = 1e3;
|
|
2622
2619
|
this.maxBackoffMs = 15e3;
|
|
2620
|
+
this.adTransitionGapMs = 1500;
|
|
2623
2621
|
initializePolyfills();
|
|
2624
2622
|
var browserOverrides = getBrowserConfigOverrides();
|
|
2625
2623
|
this.config = _object_spread({}, browserOverrides, config);
|
|
@@ -3146,7 +3144,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3146
3144
|
if (_this.config.debugAdTiming) console.warn("[StormcloudVideoPlayer] playAd(pending) failed:", err);
|
|
3147
3145
|
_this.handleAdFailure();
|
|
3148
3146
|
});
|
|
3149
|
-
},
|
|
3147
|
+
}, _this.adTransitionGapMs);
|
|
3150
3148
|
return;
|
|
3151
3149
|
}
|
|
3152
3150
|
if (remaining <= 500 && _this.expectedAdBreakDurationMs != null) {
|
|
@@ -3926,7 +3924,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3926
3924
|
isFetching: false,
|
|
3927
3925
|
fetchStartTime: Date.now()
|
|
3928
3926
|
});
|
|
3929
|
-
|
|
3927
|
+
void this.adRequest().then(function() {}).catch(function() {
|
|
3930
3928
|
if (_this.config.debugAdTiming) {
|
|
3931
3929
|
console.log("[PREFETCH] Prebid auction prefetch failed, will request at playback time");
|
|
3932
3930
|
}
|
|
@@ -3943,7 +3941,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3943
3941
|
clearTimeout(this.prefetchTimerId);
|
|
3944
3942
|
this.prefetchTimerId = void 0;
|
|
3945
3943
|
}
|
|
3946
|
-
this.prefetchAdPromise = null;
|
|
3947
3944
|
this.pendingAdBreak = null;
|
|
3948
3945
|
}
|
|
3949
3946
|
},
|
|
@@ -3971,6 +3968,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3971
3968
|
2,
|
|
3972
3969
|
"break"
|
|
3973
3970
|
];
|
|
3971
|
+
if (_this.totalAdRequestsInBreak >= _this.maxTotalAdRequestsPerBreak) return [
|
|
3972
|
+
2,
|
|
3973
|
+
"break"
|
|
3974
|
+
];
|
|
3974
3975
|
delay = _this.lastAdRequestTime ? _this.minAdRequestIntervalMs + (_this.consecutiveFailures > 0 ? backoffMs() : 0) : 0;
|
|
3975
3976
|
elapsed = Date.now() - _this.lastAdRequestTime;
|
|
3976
3977
|
if (!(elapsed < delay && _this.lastAdRequestTime > 0)) return [
|
|
@@ -4164,14 +4165,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4164
4165
|
this.expectedAdBreakDurationMs = adBreakDurationMs;
|
|
4165
4166
|
}
|
|
4166
4167
|
this.clearPendingAdBreak();
|
|
4167
|
-
this.startContinuousFetchLoop();
|
|
4168
4168
|
_state.label = 1;
|
|
4169
4169
|
case 1:
|
|
4170
4170
|
_state.trys.push([
|
|
4171
4171
|
1,
|
|
4172
|
-
|
|
4172
|
+
7,
|
|
4173
4173
|
,
|
|
4174
|
-
|
|
4174
|
+
9
|
|
4175
4175
|
]);
|
|
4176
4176
|
this.lastAdRequestTime = Date.now();
|
|
4177
4177
|
return [
|
|
@@ -4211,27 +4211,40 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4211
4211
|
this.adLayer.setAdVolume(adVolume);
|
|
4212
4212
|
return [
|
|
4213
4213
|
3,
|
|
4214
|
-
|
|
4214
|
+
6
|
|
4215
4215
|
];
|
|
4216
4216
|
case 4:
|
|
4217
4217
|
this.consecutiveFailures++;
|
|
4218
|
-
|
|
4218
|
+
return [
|
|
4219
|
+
4,
|
|
4220
|
+
this.showPlaceholderAndWaitForAds()
|
|
4221
|
+
];
|
|
4219
4222
|
case 5:
|
|
4223
|
+
_state.sent();
|
|
4224
|
+
_state.label = 6;
|
|
4225
|
+
case 6:
|
|
4220
4226
|
return [
|
|
4221
4227
|
3,
|
|
4222
|
-
|
|
4228
|
+
9
|
|
4223
4229
|
];
|
|
4224
|
-
case
|
|
4230
|
+
case 7:
|
|
4225
4231
|
error = _state.sent();
|
|
4226
4232
|
if (this.config.debugAdTiming) {
|
|
4227
4233
|
console.warn("[CONTINUOUS-FETCH] \u26A0\uFE0F First ad request failed:", error);
|
|
4228
4234
|
}
|
|
4229
4235
|
this.consecutiveFailures++;
|
|
4236
|
+
return [
|
|
4237
|
+
4,
|
|
4238
|
+
this.showPlaceholderAndWaitForAds()
|
|
4239
|
+
];
|
|
4240
|
+
case 8:
|
|
4241
|
+
_state.sent();
|
|
4230
4242
|
return [
|
|
4231
4243
|
3,
|
|
4232
|
-
|
|
4244
|
+
9
|
|
4233
4245
|
];
|
|
4234
|
-
case
|
|
4246
|
+
case 9:
|
|
4247
|
+
this.startContinuousFetchLoop();
|
|
4235
4248
|
return [
|
|
4236
4249
|
2
|
|
4237
4250
|
];
|
|
@@ -4307,6 +4320,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4307
4320
|
return _ts_generator(this, function(_state) {
|
|
4308
4321
|
switch(_state.label){
|
|
4309
4322
|
case 0:
|
|
4323
|
+
if (this.totalAdRequestsInBreak >= this.maxTotalAdRequestsPerBreak) {
|
|
4324
|
+
if (this.config.debugAdTiming) {
|
|
4325
|
+
console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 Max ad requests per break (".concat(this.maxTotalAdRequestsPerBreak, ") reached"));
|
|
4326
|
+
}
|
|
4327
|
+
this.handleAdPodComplete();
|
|
4328
|
+
return [
|
|
4329
|
+
2
|
|
4330
|
+
];
|
|
4331
|
+
}
|
|
4310
4332
|
remaining = this.getRemainingAdMs();
|
|
4311
4333
|
if (remaining <= 500 && this.expectedAdBreakDurationMs != null) {
|
|
4312
4334
|
if (this.config.debugAdTiming) {
|
|
@@ -4330,9 +4352,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4330
4352
|
case 1:
|
|
4331
4353
|
_state.trys.push([
|
|
4332
4354
|
1,
|
|
4333
|
-
|
|
4355
|
+
9,
|
|
4334
4356
|
,
|
|
4335
|
-
|
|
4357
|
+
11
|
|
4336
4358
|
]);
|
|
4337
4359
|
this.lastAdRequestTime = Date.now();
|
|
4338
4360
|
return [
|
|
@@ -4381,27 +4403,39 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4381
4403
|
case 5:
|
|
4382
4404
|
return [
|
|
4383
4405
|
3,
|
|
4384
|
-
|
|
4406
|
+
8
|
|
4385
4407
|
];
|
|
4386
4408
|
case 6:
|
|
4387
4409
|
this.consecutiveFailures++;
|
|
4388
|
-
|
|
4410
|
+
return [
|
|
4411
|
+
4,
|
|
4412
|
+
this.showPlaceholderAndWaitForAds()
|
|
4413
|
+
];
|
|
4389
4414
|
case 7:
|
|
4415
|
+
_state.sent();
|
|
4416
|
+
_state.label = 8;
|
|
4417
|
+
case 8:
|
|
4390
4418
|
return [
|
|
4391
4419
|
3,
|
|
4392
|
-
|
|
4420
|
+
11
|
|
4393
4421
|
];
|
|
4394
|
-
case
|
|
4422
|
+
case 9:
|
|
4395
4423
|
error = _state.sent();
|
|
4396
4424
|
this.consecutiveFailures++;
|
|
4397
4425
|
if (this.config.debugAdTiming) {
|
|
4398
4426
|
console.warn("[CONTINUOUS-FETCH] tryNextAvailableAd request failed:", error);
|
|
4399
4427
|
}
|
|
4428
|
+
return [
|
|
4429
|
+
4,
|
|
4430
|
+
this.showPlaceholderAndWaitForAds()
|
|
4431
|
+
];
|
|
4432
|
+
case 10:
|
|
4433
|
+
_state.sent();
|
|
4400
4434
|
return [
|
|
4401
4435
|
3,
|
|
4402
|
-
|
|
4436
|
+
11
|
|
4403
4437
|
];
|
|
4404
|
-
case
|
|
4438
|
+
case 11:
|
|
4405
4439
|
return [
|
|
4406
4440
|
2
|
|
4407
4441
|
];
|
|
@@ -4477,7 +4511,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4477
4511
|
this.pendingNextAdBids = null;
|
|
4478
4512
|
this.isShowingPlaceholder = false;
|
|
4479
4513
|
this.adLayer.hidePlaceholder();
|
|
4480
|
-
this.adLayer.updateOriginalMutedState(this.video.muted, this.video.volume);
|
|
4481
4514
|
this.currentAdIndex++;
|
|
4482
4515
|
_state.label = 3;
|
|
4483
4516
|
case 3:
|
|
@@ -5031,7 +5064,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5031
5064
|
}
|
|
5032
5065
|
(_this_hls = this.hls) === null || _this_hls === void 0 ? void 0 : _this_hls.destroy();
|
|
5033
5066
|
(_this_adLayer = this.adLayer) === null || _this_adLayer === void 0 ? void 0 : _this_adLayer.destroy();
|
|
5034
|
-
this.adRequestQueue = [];
|
|
5035
5067
|
this.consecutiveFailures = 0;
|
|
5036
5068
|
}
|
|
5037
5069
|
}
|