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/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);
|
|
@@ -3103,10 +3101,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3103
3101
|
console.log("[StormcloudVideoPlayer] Starting ad break timer on content_pause (first ad starting)");
|
|
3104
3102
|
}
|
|
3105
3103
|
}
|
|
3106
|
-
|
|
3107
|
-
var currentVolume = _this.video.volume;
|
|
3108
|
-
var adVolume = currentMuted ? 0 : currentVolume;
|
|
3109
|
-
_this.adLayer.setAdVolume(adVolume);
|
|
3104
|
+
_this.adLayer.setAdVolume(_this.adLayer.getOriginalMutedState() ? 0 : _this.adLayer.getOriginalVolume());
|
|
3110
3105
|
if (_this.isShowingPlaceholder) {
|
|
3111
3106
|
if (_this.config.debugAdTiming) {
|
|
3112
3107
|
console.log("[StormcloudVideoPlayer] Hiding placeholder - new ads starting");
|
|
@@ -3140,18 +3135,16 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3140
3135
|
_this.video.muted = true;
|
|
3141
3136
|
_this.video.volume = 0;
|
|
3142
3137
|
}
|
|
3143
|
-
_this.adLayer.updateOriginalMutedState(_this.video.muted, _this.video.volume);
|
|
3144
3138
|
_this.showPlaceholderLayer();
|
|
3145
3139
|
_this.adLayer.showPlaceholder();
|
|
3146
3140
|
setTimeout(function() {
|
|
3147
3141
|
if (!_this.inAdBreak || bids.length === 0) return;
|
|
3148
3142
|
_this.currentAdIndex++;
|
|
3149
|
-
_this.adLayer.updateOriginalMutedState(_this.video.muted, _this.video.volume);
|
|
3150
3143
|
_this.adLayer.playAd(bids).catch(function(err) {
|
|
3151
3144
|
if (_this.config.debugAdTiming) console.warn("[StormcloudVideoPlayer] playAd(pending) failed:", err);
|
|
3152
3145
|
_this.handleAdFailure();
|
|
3153
3146
|
});
|
|
3154
|
-
},
|
|
3147
|
+
}, _this.adTransitionGapMs);
|
|
3155
3148
|
return;
|
|
3156
3149
|
}
|
|
3157
3150
|
if (remaining <= 500 && _this.expectedAdBreakDurationMs != null) {
|
|
@@ -3574,7 +3567,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3574
3567
|
if (!this.adLayer.isAdPlaying() && this.pendingNextAdBids != null && this.pendingNextAdBids.length > 0) {
|
|
3575
3568
|
var bids = this.pendingNextAdBids;
|
|
3576
3569
|
this.pendingNextAdBids = null;
|
|
3577
|
-
this.adLayer.updateOriginalMutedState(this.video.muted, this.video.volume);
|
|
3578
3570
|
this.currentAdIndex++;
|
|
3579
3571
|
this.adLayer.playAd(bids).catch(function() {
|
|
3580
3572
|
return _this.handleAdFailure();
|
|
@@ -3932,7 +3924,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3932
3924
|
isFetching: false,
|
|
3933
3925
|
fetchStartTime: Date.now()
|
|
3934
3926
|
});
|
|
3935
|
-
|
|
3927
|
+
void this.adRequest().then(function() {}).catch(function() {
|
|
3936
3928
|
if (_this.config.debugAdTiming) {
|
|
3937
3929
|
console.log("[PREFETCH] Prebid auction prefetch failed, will request at playback time");
|
|
3938
3930
|
}
|
|
@@ -3949,7 +3941,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3949
3941
|
clearTimeout(this.prefetchTimerId);
|
|
3950
3942
|
this.prefetchTimerId = void 0;
|
|
3951
3943
|
}
|
|
3952
|
-
this.prefetchAdPromise = null;
|
|
3953
3944
|
this.pendingAdBreak = null;
|
|
3954
3945
|
}
|
|
3955
3946
|
},
|
|
@@ -3969,7 +3960,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3969
3960
|
switch(_state.label){
|
|
3970
3961
|
case 0:
|
|
3971
3962
|
_loop = function() {
|
|
3972
|
-
var delay, elapsed, bids,
|
|
3963
|
+
var delay, elapsed, bids, err;
|
|
3973
3964
|
return _ts_generator(this, function(_state) {
|
|
3974
3965
|
switch(_state.label){
|
|
3975
3966
|
case 0:
|
|
@@ -3977,6 +3968,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3977
3968
|
2,
|
|
3978
3969
|
"break"
|
|
3979
3970
|
];
|
|
3971
|
+
if (_this.totalAdRequestsInBreak >= _this.maxTotalAdRequestsPerBreak) return [
|
|
3972
|
+
2,
|
|
3973
|
+
"break"
|
|
3974
|
+
];
|
|
3980
3975
|
delay = _this.lastAdRequestTime ? _this.minAdRequestIntervalMs + (_this.consecutiveFailures > 0 ? backoffMs() : 0) : 0;
|
|
3981
3976
|
elapsed = Date.now() - _this.lastAdRequestTime;
|
|
3982
3977
|
if (!(elapsed < delay && _this.lastAdRequestTime > 0)) return [
|
|
@@ -4034,7 +4029,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4034
4029
|
7
|
|
4035
4030
|
];
|
|
4036
4031
|
case 5:
|
|
4037
|
-
_this.adLayer.updateOriginalMutedState(_this.video.muted, _this.video.volume);
|
|
4038
4032
|
_this.currentAdIndex++;
|
|
4039
4033
|
if (_this.config.licenseKey) {
|
|
4040
4034
|
sendAdLoadedTracking(_this.config.licenseKey, {
|
|
@@ -4051,8 +4045,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4051
4045
|
if (_this.expectedAdBreakDurationMs != null && _this.adStopTimerId == null) {
|
|
4052
4046
|
_this.scheduleAdStopCountdown(_this.getRemainingAdMs());
|
|
4053
4047
|
}
|
|
4054
|
-
|
|
4055
|
-
_this.adLayer.setAdVolume(adVolume);
|
|
4048
|
+
_this.adLayer.setAdVolume(_this.adLayer.getOriginalMutedState() ? 0 : _this.adLayer.getOriginalVolume());
|
|
4056
4049
|
_state.label = 7;
|
|
4057
4050
|
case 7:
|
|
4058
4051
|
return [
|
|
@@ -4172,14 +4165,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4172
4165
|
this.expectedAdBreakDurationMs = adBreakDurationMs;
|
|
4173
4166
|
}
|
|
4174
4167
|
this.clearPendingAdBreak();
|
|
4175
|
-
this.startContinuousFetchLoop();
|
|
4176
4168
|
_state.label = 1;
|
|
4177
4169
|
case 1:
|
|
4178
4170
|
_state.trys.push([
|
|
4179
4171
|
1,
|
|
4180
|
-
|
|
4172
|
+
7,
|
|
4181
4173
|
,
|
|
4182
|
-
|
|
4174
|
+
9
|
|
4183
4175
|
]);
|
|
4184
4176
|
this.lastAdRequestTime = Date.now();
|
|
4185
4177
|
return [
|
|
@@ -4219,27 +4211,40 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4219
4211
|
this.adLayer.setAdVolume(adVolume);
|
|
4220
4212
|
return [
|
|
4221
4213
|
3,
|
|
4222
|
-
|
|
4214
|
+
6
|
|
4223
4215
|
];
|
|
4224
4216
|
case 4:
|
|
4225
4217
|
this.consecutiveFailures++;
|
|
4226
|
-
|
|
4218
|
+
return [
|
|
4219
|
+
4,
|
|
4220
|
+
this.showPlaceholderAndWaitForAds()
|
|
4221
|
+
];
|
|
4227
4222
|
case 5:
|
|
4223
|
+
_state.sent();
|
|
4224
|
+
_state.label = 6;
|
|
4225
|
+
case 6:
|
|
4228
4226
|
return [
|
|
4229
4227
|
3,
|
|
4230
|
-
|
|
4228
|
+
9
|
|
4231
4229
|
];
|
|
4232
|
-
case
|
|
4230
|
+
case 7:
|
|
4233
4231
|
error = _state.sent();
|
|
4234
4232
|
if (this.config.debugAdTiming) {
|
|
4235
4233
|
console.warn("[CONTINUOUS-FETCH] \u26A0\uFE0F First ad request failed:", error);
|
|
4236
4234
|
}
|
|
4237
4235
|
this.consecutiveFailures++;
|
|
4236
|
+
return [
|
|
4237
|
+
4,
|
|
4238
|
+
this.showPlaceholderAndWaitForAds()
|
|
4239
|
+
];
|
|
4240
|
+
case 8:
|
|
4241
|
+
_state.sent();
|
|
4238
4242
|
return [
|
|
4239
4243
|
3,
|
|
4240
|
-
|
|
4244
|
+
9
|
|
4241
4245
|
];
|
|
4242
|
-
case
|
|
4246
|
+
case 9:
|
|
4247
|
+
this.startContinuousFetchLoop();
|
|
4243
4248
|
return [
|
|
4244
4249
|
2
|
|
4245
4250
|
];
|
|
@@ -4315,6 +4320,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4315
4320
|
return _ts_generator(this, function(_state) {
|
|
4316
4321
|
switch(_state.label){
|
|
4317
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
|
+
}
|
|
4318
4332
|
remaining = this.getRemainingAdMs();
|
|
4319
4333
|
if (remaining <= 500 && this.expectedAdBreakDurationMs != null) {
|
|
4320
4334
|
if (this.config.debugAdTiming) {
|
|
@@ -4338,9 +4352,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4338
4352
|
case 1:
|
|
4339
4353
|
_state.trys.push([
|
|
4340
4354
|
1,
|
|
4341
|
-
|
|
4355
|
+
9,
|
|
4342
4356
|
,
|
|
4343
|
-
|
|
4357
|
+
11
|
|
4344
4358
|
]);
|
|
4345
4359
|
this.lastAdRequestTime = Date.now();
|
|
4346
4360
|
return [
|
|
@@ -4357,7 +4371,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4357
4371
|
6
|
|
4358
4372
|
];
|
|
4359
4373
|
this.consecutiveFailures = 0;
|
|
4360
|
-
this.adLayer.updateOriginalMutedState(this.video.muted, this.video.volume);
|
|
4361
4374
|
this.currentAdIndex++;
|
|
4362
4375
|
this.totalAdRequestsInBreak++;
|
|
4363
4376
|
if (!this.adLayer.isAdPlaying()) return [
|
|
@@ -4385,32 +4398,44 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4385
4398
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
4386
4399
|
this.scheduleAdStopCountdown(this.getRemainingAdMs());
|
|
4387
4400
|
}
|
|
4388
|
-
this.adLayer.setAdVolume(this.
|
|
4401
|
+
this.adLayer.setAdVolume(this.adLayer.getOriginalMutedState() ? 0 : this.adLayer.getOriginalVolume());
|
|
4389
4402
|
_state.label = 5;
|
|
4390
4403
|
case 5:
|
|
4391
4404
|
return [
|
|
4392
4405
|
3,
|
|
4393
|
-
|
|
4406
|
+
8
|
|
4394
4407
|
];
|
|
4395
4408
|
case 6:
|
|
4396
4409
|
this.consecutiveFailures++;
|
|
4397
|
-
|
|
4410
|
+
return [
|
|
4411
|
+
4,
|
|
4412
|
+
this.showPlaceholderAndWaitForAds()
|
|
4413
|
+
];
|
|
4398
4414
|
case 7:
|
|
4415
|
+
_state.sent();
|
|
4416
|
+
_state.label = 8;
|
|
4417
|
+
case 8:
|
|
4399
4418
|
return [
|
|
4400
4419
|
3,
|
|
4401
|
-
|
|
4420
|
+
11
|
|
4402
4421
|
];
|
|
4403
|
-
case
|
|
4422
|
+
case 9:
|
|
4404
4423
|
error = _state.sent();
|
|
4405
4424
|
this.consecutiveFailures++;
|
|
4406
4425
|
if (this.config.debugAdTiming) {
|
|
4407
4426
|
console.warn("[CONTINUOUS-FETCH] tryNextAvailableAd request failed:", error);
|
|
4408
4427
|
}
|
|
4428
|
+
return [
|
|
4429
|
+
4,
|
|
4430
|
+
this.showPlaceholderAndWaitForAds()
|
|
4431
|
+
];
|
|
4432
|
+
case 10:
|
|
4433
|
+
_state.sent();
|
|
4409
4434
|
return [
|
|
4410
4435
|
3,
|
|
4411
|
-
|
|
4436
|
+
11
|
|
4412
4437
|
];
|
|
4413
|
-
case
|
|
4438
|
+
case 11:
|
|
4414
4439
|
return [
|
|
4415
4440
|
2
|
|
4416
4441
|
];
|
|
@@ -4486,7 +4511,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4486
4511
|
this.pendingNextAdBids = null;
|
|
4487
4512
|
this.isShowingPlaceholder = false;
|
|
4488
4513
|
this.adLayer.hidePlaceholder();
|
|
4489
|
-
this.adLayer.updateOriginalMutedState(this.video.muted, this.video.volume);
|
|
4490
4514
|
this.currentAdIndex++;
|
|
4491
4515
|
_state.label = 3;
|
|
4492
4516
|
case 3:
|
|
@@ -5040,7 +5064,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5040
5064
|
}
|
|
5041
5065
|
(_this_hls = this.hls) === null || _this_hls === void 0 ? void 0 : _this_hls.destroy();
|
|
5042
5066
|
(_this_adLayer = this.adLayer) === null || _this_adLayer === void 0 ? void 0 : _this_adLayer.destroy();
|
|
5043
|
-
this.adRequestQueue = [];
|
|
5044
5067
|
this.consecutiveFailures = 0;
|
|
5045
5068
|
}
|
|
5046
5069
|
}
|