stormcloud-video-player 0.5.11 → 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 +61 -38
- 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 +61 -38
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +61 -38
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +1 -3
- package/lib/players/HlsPlayer.cjs +61 -38
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +61 -38
- package/lib/players/index.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +61 -38
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -2720,18 +2720,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
2720
2720
|
this.bufferedSegmentsCount = 0;
|
|
2721
2721
|
this.shouldAutoplayAfterBuffering = false;
|
|
2722
2722
|
this.hasInitialBufferCompleted = false;
|
|
2723
|
-
this.adRequestTokenCounter = 0;
|
|
2724
2723
|
this.activeAdRequestToken = null;
|
|
2725
2724
|
this.adRequestWatchdogToken = null;
|
|
2726
2725
|
this.adFailsafeToken = null;
|
|
2727
2726
|
this.continuousFetchingActive = false;
|
|
2728
|
-
this.adRequestQueue = [];
|
|
2729
2727
|
this.maxPlaceholderDurationMs = 5e3;
|
|
2730
2728
|
this.isShowingPlaceholder = false;
|
|
2731
2729
|
this.totalAdRequestsInBreak = 0;
|
|
2732
2730
|
this.maxTotalAdRequestsPerBreak = 20;
|
|
2733
2731
|
this.pendingAdBreak = null;
|
|
2734
|
-
this.prefetchAdPromise = null;
|
|
2735
2732
|
this.savedMutedStateBeforeScte = null;
|
|
2736
2733
|
this.consecutiveFailures = 0;
|
|
2737
2734
|
this.maxConsecutiveFailures = 5;
|
|
@@ -2739,6 +2736,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
2739
2736
|
this.minAdRequestIntervalMs = 2500;
|
|
2740
2737
|
this.backoffBaseMs = 1e3;
|
|
2741
2738
|
this.maxBackoffMs = 15e3;
|
|
2739
|
+
this.adTransitionGapMs = 1500;
|
|
2742
2740
|
initializePolyfills();
|
|
2743
2741
|
var browserOverrides = getBrowserConfigOverrides();
|
|
2744
2742
|
this.config = _object_spread({}, browserOverrides, config);
|
|
@@ -3222,10 +3220,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3222
3220
|
console.log("[StormcloudVideoPlayer] Starting ad break timer on content_pause (first ad starting)");
|
|
3223
3221
|
}
|
|
3224
3222
|
}
|
|
3225
|
-
|
|
3226
|
-
var currentVolume = _this.video.volume;
|
|
3227
|
-
var adVolume = currentMuted ? 0 : currentVolume;
|
|
3228
|
-
_this.adLayer.setAdVolume(adVolume);
|
|
3223
|
+
_this.adLayer.setAdVolume(_this.adLayer.getOriginalMutedState() ? 0 : _this.adLayer.getOriginalVolume());
|
|
3229
3224
|
if (_this.isShowingPlaceholder) {
|
|
3230
3225
|
if (_this.config.debugAdTiming) {
|
|
3231
3226
|
console.log("[StormcloudVideoPlayer] Hiding placeholder - new ads starting");
|
|
@@ -3259,18 +3254,16 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3259
3254
|
_this.video.muted = true;
|
|
3260
3255
|
_this.video.volume = 0;
|
|
3261
3256
|
}
|
|
3262
|
-
_this.adLayer.updateOriginalMutedState(_this.video.muted, _this.video.volume);
|
|
3263
3257
|
_this.showPlaceholderLayer();
|
|
3264
3258
|
_this.adLayer.showPlaceholder();
|
|
3265
3259
|
setTimeout(function() {
|
|
3266
3260
|
if (!_this.inAdBreak || bids.length === 0) return;
|
|
3267
3261
|
_this.currentAdIndex++;
|
|
3268
|
-
_this.adLayer.updateOriginalMutedState(_this.video.muted, _this.video.volume);
|
|
3269
3262
|
_this.adLayer.playAd(bids).catch(function(err) {
|
|
3270
3263
|
if (_this.config.debugAdTiming) console.warn("[StormcloudVideoPlayer] playAd(pending) failed:", err);
|
|
3271
3264
|
_this.handleAdFailure();
|
|
3272
3265
|
});
|
|
3273
|
-
},
|
|
3266
|
+
}, _this.adTransitionGapMs);
|
|
3274
3267
|
return;
|
|
3275
3268
|
}
|
|
3276
3269
|
if (remaining <= 500 && _this.expectedAdBreakDurationMs != null) {
|
|
@@ -3693,7 +3686,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3693
3686
|
if (!this.adLayer.isAdPlaying() && this.pendingNextAdBids != null && this.pendingNextAdBids.length > 0) {
|
|
3694
3687
|
var bids = this.pendingNextAdBids;
|
|
3695
3688
|
this.pendingNextAdBids = null;
|
|
3696
|
-
this.adLayer.updateOriginalMutedState(this.video.muted, this.video.volume);
|
|
3697
3689
|
this.currentAdIndex++;
|
|
3698
3690
|
this.adLayer.playAd(bids).catch(function() {
|
|
3699
3691
|
return _this.handleAdFailure();
|
|
@@ -4051,7 +4043,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4051
4043
|
isFetching: false,
|
|
4052
4044
|
fetchStartTime: Date.now()
|
|
4053
4045
|
});
|
|
4054
|
-
|
|
4046
|
+
void this.adRequest().then(function() {}).catch(function() {
|
|
4055
4047
|
if (_this.config.debugAdTiming) {
|
|
4056
4048
|
console.log("[PREFETCH] Prebid auction prefetch failed, will request at playback time");
|
|
4057
4049
|
}
|
|
@@ -4068,7 +4060,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4068
4060
|
clearTimeout(this.prefetchTimerId);
|
|
4069
4061
|
this.prefetchTimerId = void 0;
|
|
4070
4062
|
}
|
|
4071
|
-
this.prefetchAdPromise = null;
|
|
4072
4063
|
this.pendingAdBreak = null;
|
|
4073
4064
|
}
|
|
4074
4065
|
},
|
|
@@ -4088,7 +4079,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4088
4079
|
switch(_state.label){
|
|
4089
4080
|
case 0:
|
|
4090
4081
|
_loop = function() {
|
|
4091
|
-
var delay, elapsed, bids,
|
|
4082
|
+
var delay, elapsed, bids, err;
|
|
4092
4083
|
return _ts_generator(this, function(_state) {
|
|
4093
4084
|
switch(_state.label){
|
|
4094
4085
|
case 0:
|
|
@@ -4096,6 +4087,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4096
4087
|
2,
|
|
4097
4088
|
"break"
|
|
4098
4089
|
];
|
|
4090
|
+
if (_this.totalAdRequestsInBreak >= _this.maxTotalAdRequestsPerBreak) return [
|
|
4091
|
+
2,
|
|
4092
|
+
"break"
|
|
4093
|
+
];
|
|
4099
4094
|
delay = _this.lastAdRequestTime ? _this.minAdRequestIntervalMs + (_this.consecutiveFailures > 0 ? backoffMs() : 0) : 0;
|
|
4100
4095
|
elapsed = Date.now() - _this.lastAdRequestTime;
|
|
4101
4096
|
if (!(elapsed < delay && _this.lastAdRequestTime > 0)) return [
|
|
@@ -4153,7 +4148,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4153
4148
|
7
|
|
4154
4149
|
];
|
|
4155
4150
|
case 5:
|
|
4156
|
-
_this.adLayer.updateOriginalMutedState(_this.video.muted, _this.video.volume);
|
|
4157
4151
|
_this.currentAdIndex++;
|
|
4158
4152
|
if (_this.config.licenseKey) {
|
|
4159
4153
|
sendAdLoadedTracking(_this.config.licenseKey, {
|
|
@@ -4170,8 +4164,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4170
4164
|
if (_this.expectedAdBreakDurationMs != null && _this.adStopTimerId == null) {
|
|
4171
4165
|
_this.scheduleAdStopCountdown(_this.getRemainingAdMs());
|
|
4172
4166
|
}
|
|
4173
|
-
|
|
4174
|
-
_this.adLayer.setAdVolume(adVolume);
|
|
4167
|
+
_this.adLayer.setAdVolume(_this.adLayer.getOriginalMutedState() ? 0 : _this.adLayer.getOriginalVolume());
|
|
4175
4168
|
_state.label = 7;
|
|
4176
4169
|
case 7:
|
|
4177
4170
|
return [
|
|
@@ -4291,14 +4284,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4291
4284
|
this.expectedAdBreakDurationMs = adBreakDurationMs;
|
|
4292
4285
|
}
|
|
4293
4286
|
this.clearPendingAdBreak();
|
|
4294
|
-
this.startContinuousFetchLoop();
|
|
4295
4287
|
_state.label = 1;
|
|
4296
4288
|
case 1:
|
|
4297
4289
|
_state.trys.push([
|
|
4298
4290
|
1,
|
|
4299
|
-
|
|
4291
|
+
7,
|
|
4300
4292
|
,
|
|
4301
|
-
|
|
4293
|
+
9
|
|
4302
4294
|
]);
|
|
4303
4295
|
this.lastAdRequestTime = Date.now();
|
|
4304
4296
|
return [
|
|
@@ -4338,27 +4330,40 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4338
4330
|
this.adLayer.setAdVolume(adVolume);
|
|
4339
4331
|
return [
|
|
4340
4332
|
3,
|
|
4341
|
-
|
|
4333
|
+
6
|
|
4342
4334
|
];
|
|
4343
4335
|
case 4:
|
|
4344
4336
|
this.consecutiveFailures++;
|
|
4345
|
-
|
|
4337
|
+
return [
|
|
4338
|
+
4,
|
|
4339
|
+
this.showPlaceholderAndWaitForAds()
|
|
4340
|
+
];
|
|
4346
4341
|
case 5:
|
|
4342
|
+
_state.sent();
|
|
4343
|
+
_state.label = 6;
|
|
4344
|
+
case 6:
|
|
4347
4345
|
return [
|
|
4348
4346
|
3,
|
|
4349
|
-
|
|
4347
|
+
9
|
|
4350
4348
|
];
|
|
4351
|
-
case
|
|
4349
|
+
case 7:
|
|
4352
4350
|
error = _state.sent();
|
|
4353
4351
|
if (this.config.debugAdTiming) {
|
|
4354
4352
|
console.warn("[CONTINUOUS-FETCH] \u26A0\uFE0F First ad request failed:", error);
|
|
4355
4353
|
}
|
|
4356
4354
|
this.consecutiveFailures++;
|
|
4355
|
+
return [
|
|
4356
|
+
4,
|
|
4357
|
+
this.showPlaceholderAndWaitForAds()
|
|
4358
|
+
];
|
|
4359
|
+
case 8:
|
|
4360
|
+
_state.sent();
|
|
4357
4361
|
return [
|
|
4358
4362
|
3,
|
|
4359
|
-
|
|
4363
|
+
9
|
|
4360
4364
|
];
|
|
4361
|
-
case
|
|
4365
|
+
case 9:
|
|
4366
|
+
this.startContinuousFetchLoop();
|
|
4362
4367
|
return [
|
|
4363
4368
|
2
|
|
4364
4369
|
];
|
|
@@ -4434,6 +4439,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4434
4439
|
return _ts_generator(this, function(_state) {
|
|
4435
4440
|
switch(_state.label){
|
|
4436
4441
|
case 0:
|
|
4442
|
+
if (this.totalAdRequestsInBreak >= this.maxTotalAdRequestsPerBreak) {
|
|
4443
|
+
if (this.config.debugAdTiming) {
|
|
4444
|
+
console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 Max ad requests per break (".concat(this.maxTotalAdRequestsPerBreak, ") reached"));
|
|
4445
|
+
}
|
|
4446
|
+
this.handleAdPodComplete();
|
|
4447
|
+
return [
|
|
4448
|
+
2
|
|
4449
|
+
];
|
|
4450
|
+
}
|
|
4437
4451
|
remaining = this.getRemainingAdMs();
|
|
4438
4452
|
if (remaining <= 500 && this.expectedAdBreakDurationMs != null) {
|
|
4439
4453
|
if (this.config.debugAdTiming) {
|
|
@@ -4457,9 +4471,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4457
4471
|
case 1:
|
|
4458
4472
|
_state.trys.push([
|
|
4459
4473
|
1,
|
|
4460
|
-
|
|
4474
|
+
9,
|
|
4461
4475
|
,
|
|
4462
|
-
|
|
4476
|
+
11
|
|
4463
4477
|
]);
|
|
4464
4478
|
this.lastAdRequestTime = Date.now();
|
|
4465
4479
|
return [
|
|
@@ -4476,7 +4490,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4476
4490
|
6
|
|
4477
4491
|
];
|
|
4478
4492
|
this.consecutiveFailures = 0;
|
|
4479
|
-
this.adLayer.updateOriginalMutedState(this.video.muted, this.video.volume);
|
|
4480
4493
|
this.currentAdIndex++;
|
|
4481
4494
|
this.totalAdRequestsInBreak++;
|
|
4482
4495
|
if (!this.adLayer.isAdPlaying()) return [
|
|
@@ -4504,32 +4517,44 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4504
4517
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
4505
4518
|
this.scheduleAdStopCountdown(this.getRemainingAdMs());
|
|
4506
4519
|
}
|
|
4507
|
-
this.adLayer.setAdVolume(this.
|
|
4520
|
+
this.adLayer.setAdVolume(this.adLayer.getOriginalMutedState() ? 0 : this.adLayer.getOriginalVolume());
|
|
4508
4521
|
_state.label = 5;
|
|
4509
4522
|
case 5:
|
|
4510
4523
|
return [
|
|
4511
4524
|
3,
|
|
4512
|
-
|
|
4525
|
+
8
|
|
4513
4526
|
];
|
|
4514
4527
|
case 6:
|
|
4515
4528
|
this.consecutiveFailures++;
|
|
4516
|
-
|
|
4529
|
+
return [
|
|
4530
|
+
4,
|
|
4531
|
+
this.showPlaceholderAndWaitForAds()
|
|
4532
|
+
];
|
|
4517
4533
|
case 7:
|
|
4534
|
+
_state.sent();
|
|
4535
|
+
_state.label = 8;
|
|
4536
|
+
case 8:
|
|
4518
4537
|
return [
|
|
4519
4538
|
3,
|
|
4520
|
-
|
|
4539
|
+
11
|
|
4521
4540
|
];
|
|
4522
|
-
case
|
|
4541
|
+
case 9:
|
|
4523
4542
|
error = _state.sent();
|
|
4524
4543
|
this.consecutiveFailures++;
|
|
4525
4544
|
if (this.config.debugAdTiming) {
|
|
4526
4545
|
console.warn("[CONTINUOUS-FETCH] tryNextAvailableAd request failed:", error);
|
|
4527
4546
|
}
|
|
4547
|
+
return [
|
|
4548
|
+
4,
|
|
4549
|
+
this.showPlaceholderAndWaitForAds()
|
|
4550
|
+
];
|
|
4551
|
+
case 10:
|
|
4552
|
+
_state.sent();
|
|
4528
4553
|
return [
|
|
4529
4554
|
3,
|
|
4530
|
-
|
|
4555
|
+
11
|
|
4531
4556
|
];
|
|
4532
|
-
case
|
|
4557
|
+
case 11:
|
|
4533
4558
|
return [
|
|
4534
4559
|
2
|
|
4535
4560
|
];
|
|
@@ -4605,7 +4630,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4605
4630
|
this.pendingNextAdBids = null;
|
|
4606
4631
|
this.isShowingPlaceholder = false;
|
|
4607
4632
|
this.adLayer.hidePlaceholder();
|
|
4608
|
-
this.adLayer.updateOriginalMutedState(this.video.muted, this.video.volume);
|
|
4609
4633
|
this.currentAdIndex++;
|
|
4610
4634
|
_state.label = 3;
|
|
4611
4635
|
case 3:
|
|
@@ -5159,7 +5183,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5159
5183
|
}
|
|
5160
5184
|
(_this_hls = this.hls) === null || _this_hls === void 0 ? void 0 : _this_hls.destroy();
|
|
5161
5185
|
(_this_adLayer = this.adLayer) === null || _this_adLayer === void 0 ? void 0 : _this_adLayer.destroy();
|
|
5162
|
-
this.adRequestQueue = [];
|
|
5163
5186
|
this.consecutiveFailures = 0;
|
|
5164
5187
|
}
|
|
5165
5188
|
}
|