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
|
@@ -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);
|
|
@@ -3053,10 +3051,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3053
3051
|
console.log("[StormcloudVideoPlayer] Starting ad break timer on content_pause (first ad starting)");
|
|
3054
3052
|
}
|
|
3055
3053
|
}
|
|
3056
|
-
|
|
3057
|
-
var currentVolume = _this.video.volume;
|
|
3058
|
-
var adVolume = currentMuted ? 0 : currentVolume;
|
|
3059
|
-
_this.adLayer.setAdVolume(adVolume);
|
|
3054
|
+
_this.adLayer.setAdVolume(_this.adLayer.getOriginalMutedState() ? 0 : _this.adLayer.getOriginalVolume());
|
|
3060
3055
|
if (_this.isShowingPlaceholder) {
|
|
3061
3056
|
if (_this.config.debugAdTiming) {
|
|
3062
3057
|
console.log("[StormcloudVideoPlayer] Hiding placeholder - new ads starting");
|
|
@@ -3090,18 +3085,16 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3090
3085
|
_this.video.muted = true;
|
|
3091
3086
|
_this.video.volume = 0;
|
|
3092
3087
|
}
|
|
3093
|
-
_this.adLayer.updateOriginalMutedState(_this.video.muted, _this.video.volume);
|
|
3094
3088
|
_this.showPlaceholderLayer();
|
|
3095
3089
|
_this.adLayer.showPlaceholder();
|
|
3096
3090
|
setTimeout(function() {
|
|
3097
3091
|
if (!_this.inAdBreak || bids.length === 0) return;
|
|
3098
3092
|
_this.currentAdIndex++;
|
|
3099
|
-
_this.adLayer.updateOriginalMutedState(_this.video.muted, _this.video.volume);
|
|
3100
3093
|
_this.adLayer.playAd(bids).catch(function(err) {
|
|
3101
3094
|
if (_this.config.debugAdTiming) console.warn("[StormcloudVideoPlayer] playAd(pending) failed:", err);
|
|
3102
3095
|
_this.handleAdFailure();
|
|
3103
3096
|
});
|
|
3104
|
-
},
|
|
3097
|
+
}, _this.adTransitionGapMs);
|
|
3105
3098
|
return;
|
|
3106
3099
|
}
|
|
3107
3100
|
if (remaining <= 500 && _this.expectedAdBreakDurationMs != null) {
|
|
@@ -3524,7 +3517,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3524
3517
|
if (!this.adLayer.isAdPlaying() && this.pendingNextAdBids != null && this.pendingNextAdBids.length > 0) {
|
|
3525
3518
|
var bids = this.pendingNextAdBids;
|
|
3526
3519
|
this.pendingNextAdBids = null;
|
|
3527
|
-
this.adLayer.updateOriginalMutedState(this.video.muted, this.video.volume);
|
|
3528
3520
|
this.currentAdIndex++;
|
|
3529
3521
|
this.adLayer.playAd(bids).catch(function() {
|
|
3530
3522
|
return _this.handleAdFailure();
|
|
@@ -3882,7 +3874,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3882
3874
|
isFetching: false,
|
|
3883
3875
|
fetchStartTime: Date.now()
|
|
3884
3876
|
});
|
|
3885
|
-
|
|
3877
|
+
void this.adRequest().then(function() {}).catch(function() {
|
|
3886
3878
|
if (_this.config.debugAdTiming) {
|
|
3887
3879
|
console.log("[PREFETCH] Prebid auction prefetch failed, will request at playback time");
|
|
3888
3880
|
}
|
|
@@ -3899,7 +3891,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3899
3891
|
clearTimeout(this.prefetchTimerId);
|
|
3900
3892
|
this.prefetchTimerId = void 0;
|
|
3901
3893
|
}
|
|
3902
|
-
this.prefetchAdPromise = null;
|
|
3903
3894
|
this.pendingAdBreak = null;
|
|
3904
3895
|
}
|
|
3905
3896
|
},
|
|
@@ -3919,7 +3910,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3919
3910
|
switch(_state.label){
|
|
3920
3911
|
case 0:
|
|
3921
3912
|
_loop = function() {
|
|
3922
|
-
var delay, elapsed, bids,
|
|
3913
|
+
var delay, elapsed, bids, err;
|
|
3923
3914
|
return _ts_generator(this, function(_state) {
|
|
3924
3915
|
switch(_state.label){
|
|
3925
3916
|
case 0:
|
|
@@ -3927,6 +3918,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3927
3918
|
2,
|
|
3928
3919
|
"break"
|
|
3929
3920
|
];
|
|
3921
|
+
if (_this.totalAdRequestsInBreak >= _this.maxTotalAdRequestsPerBreak) return [
|
|
3922
|
+
2,
|
|
3923
|
+
"break"
|
|
3924
|
+
];
|
|
3930
3925
|
delay = _this.lastAdRequestTime ? _this.minAdRequestIntervalMs + (_this.consecutiveFailures > 0 ? backoffMs() : 0) : 0;
|
|
3931
3926
|
elapsed = Date.now() - _this.lastAdRequestTime;
|
|
3932
3927
|
if (!(elapsed < delay && _this.lastAdRequestTime > 0)) return [
|
|
@@ -3984,7 +3979,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3984
3979
|
7
|
|
3985
3980
|
];
|
|
3986
3981
|
case 5:
|
|
3987
|
-
_this.adLayer.updateOriginalMutedState(_this.video.muted, _this.video.volume);
|
|
3988
3982
|
_this.currentAdIndex++;
|
|
3989
3983
|
if (_this.config.licenseKey) {
|
|
3990
3984
|
sendAdLoadedTracking(_this.config.licenseKey, {
|
|
@@ -4001,8 +3995,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4001
3995
|
if (_this.expectedAdBreakDurationMs != null && _this.adStopTimerId == null) {
|
|
4002
3996
|
_this.scheduleAdStopCountdown(_this.getRemainingAdMs());
|
|
4003
3997
|
}
|
|
4004
|
-
|
|
4005
|
-
_this.adLayer.setAdVolume(adVolume);
|
|
3998
|
+
_this.adLayer.setAdVolume(_this.adLayer.getOriginalMutedState() ? 0 : _this.adLayer.getOriginalVolume());
|
|
4006
3999
|
_state.label = 7;
|
|
4007
4000
|
case 7:
|
|
4008
4001
|
return [
|
|
@@ -4122,14 +4115,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4122
4115
|
this.expectedAdBreakDurationMs = adBreakDurationMs;
|
|
4123
4116
|
}
|
|
4124
4117
|
this.clearPendingAdBreak();
|
|
4125
|
-
this.startContinuousFetchLoop();
|
|
4126
4118
|
_state.label = 1;
|
|
4127
4119
|
case 1:
|
|
4128
4120
|
_state.trys.push([
|
|
4129
4121
|
1,
|
|
4130
|
-
|
|
4122
|
+
7,
|
|
4131
4123
|
,
|
|
4132
|
-
|
|
4124
|
+
9
|
|
4133
4125
|
]);
|
|
4134
4126
|
this.lastAdRequestTime = Date.now();
|
|
4135
4127
|
return [
|
|
@@ -4169,27 +4161,40 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4169
4161
|
this.adLayer.setAdVolume(adVolume);
|
|
4170
4162
|
return [
|
|
4171
4163
|
3,
|
|
4172
|
-
|
|
4164
|
+
6
|
|
4173
4165
|
];
|
|
4174
4166
|
case 4:
|
|
4175
4167
|
this.consecutiveFailures++;
|
|
4176
|
-
|
|
4168
|
+
return [
|
|
4169
|
+
4,
|
|
4170
|
+
this.showPlaceholderAndWaitForAds()
|
|
4171
|
+
];
|
|
4177
4172
|
case 5:
|
|
4173
|
+
_state.sent();
|
|
4174
|
+
_state.label = 6;
|
|
4175
|
+
case 6:
|
|
4178
4176
|
return [
|
|
4179
4177
|
3,
|
|
4180
|
-
|
|
4178
|
+
9
|
|
4181
4179
|
];
|
|
4182
|
-
case
|
|
4180
|
+
case 7:
|
|
4183
4181
|
error = _state.sent();
|
|
4184
4182
|
if (this.config.debugAdTiming) {
|
|
4185
4183
|
console.warn("[CONTINUOUS-FETCH] \u26A0\uFE0F First ad request failed:", error);
|
|
4186
4184
|
}
|
|
4187
4185
|
this.consecutiveFailures++;
|
|
4186
|
+
return [
|
|
4187
|
+
4,
|
|
4188
|
+
this.showPlaceholderAndWaitForAds()
|
|
4189
|
+
];
|
|
4190
|
+
case 8:
|
|
4191
|
+
_state.sent();
|
|
4188
4192
|
return [
|
|
4189
4193
|
3,
|
|
4190
|
-
|
|
4194
|
+
9
|
|
4191
4195
|
];
|
|
4192
|
-
case
|
|
4196
|
+
case 9:
|
|
4197
|
+
this.startContinuousFetchLoop();
|
|
4193
4198
|
return [
|
|
4194
4199
|
2
|
|
4195
4200
|
];
|
|
@@ -4265,6 +4270,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4265
4270
|
return _ts_generator(this, function(_state) {
|
|
4266
4271
|
switch(_state.label){
|
|
4267
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
|
+
}
|
|
4268
4282
|
remaining = this.getRemainingAdMs();
|
|
4269
4283
|
if (remaining <= 500 && this.expectedAdBreakDurationMs != null) {
|
|
4270
4284
|
if (this.config.debugAdTiming) {
|
|
@@ -4288,9 +4302,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4288
4302
|
case 1:
|
|
4289
4303
|
_state.trys.push([
|
|
4290
4304
|
1,
|
|
4291
|
-
|
|
4305
|
+
9,
|
|
4292
4306
|
,
|
|
4293
|
-
|
|
4307
|
+
11
|
|
4294
4308
|
]);
|
|
4295
4309
|
this.lastAdRequestTime = Date.now();
|
|
4296
4310
|
return [
|
|
@@ -4307,7 +4321,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4307
4321
|
6
|
|
4308
4322
|
];
|
|
4309
4323
|
this.consecutiveFailures = 0;
|
|
4310
|
-
this.adLayer.updateOriginalMutedState(this.video.muted, this.video.volume);
|
|
4311
4324
|
this.currentAdIndex++;
|
|
4312
4325
|
this.totalAdRequestsInBreak++;
|
|
4313
4326
|
if (!this.adLayer.isAdPlaying()) return [
|
|
@@ -4335,32 +4348,44 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4335
4348
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
4336
4349
|
this.scheduleAdStopCountdown(this.getRemainingAdMs());
|
|
4337
4350
|
}
|
|
4338
|
-
this.adLayer.setAdVolume(this.
|
|
4351
|
+
this.adLayer.setAdVolume(this.adLayer.getOriginalMutedState() ? 0 : this.adLayer.getOriginalVolume());
|
|
4339
4352
|
_state.label = 5;
|
|
4340
4353
|
case 5:
|
|
4341
4354
|
return [
|
|
4342
4355
|
3,
|
|
4343
|
-
|
|
4356
|
+
8
|
|
4344
4357
|
];
|
|
4345
4358
|
case 6:
|
|
4346
4359
|
this.consecutiveFailures++;
|
|
4347
|
-
|
|
4360
|
+
return [
|
|
4361
|
+
4,
|
|
4362
|
+
this.showPlaceholderAndWaitForAds()
|
|
4363
|
+
];
|
|
4348
4364
|
case 7:
|
|
4365
|
+
_state.sent();
|
|
4366
|
+
_state.label = 8;
|
|
4367
|
+
case 8:
|
|
4349
4368
|
return [
|
|
4350
4369
|
3,
|
|
4351
|
-
|
|
4370
|
+
11
|
|
4352
4371
|
];
|
|
4353
|
-
case
|
|
4372
|
+
case 9:
|
|
4354
4373
|
error = _state.sent();
|
|
4355
4374
|
this.consecutiveFailures++;
|
|
4356
4375
|
if (this.config.debugAdTiming) {
|
|
4357
4376
|
console.warn("[CONTINUOUS-FETCH] tryNextAvailableAd request failed:", error);
|
|
4358
4377
|
}
|
|
4378
|
+
return [
|
|
4379
|
+
4,
|
|
4380
|
+
this.showPlaceholderAndWaitForAds()
|
|
4381
|
+
];
|
|
4382
|
+
case 10:
|
|
4383
|
+
_state.sent();
|
|
4359
4384
|
return [
|
|
4360
4385
|
3,
|
|
4361
|
-
|
|
4386
|
+
11
|
|
4362
4387
|
];
|
|
4363
|
-
case
|
|
4388
|
+
case 11:
|
|
4364
4389
|
return [
|
|
4365
4390
|
2
|
|
4366
4391
|
];
|
|
@@ -4436,7 +4461,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4436
4461
|
this.pendingNextAdBids = null;
|
|
4437
4462
|
this.isShowingPlaceholder = false;
|
|
4438
4463
|
this.adLayer.hidePlaceholder();
|
|
4439
|
-
this.adLayer.updateOriginalMutedState(this.video.muted, this.video.volume);
|
|
4440
4464
|
this.currentAdIndex++;
|
|
4441
4465
|
_state.label = 3;
|
|
4442
4466
|
case 3:
|
|
@@ -4990,7 +5014,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4990
5014
|
}
|
|
4991
5015
|
(_this_hls = this.hls) === null || _this_hls === void 0 ? void 0 : _this_hls.destroy();
|
|
4992
5016
|
(_this_adLayer = this.adLayer) === null || _this_adLayer === void 0 ? void 0 : _this_adLayer.destroy();
|
|
4993
|
-
this.adRequestQueue = [];
|
|
4994
5017
|
this.consecutiveFailures = 0;
|
|
4995
5018
|
}
|
|
4996
5019
|
}
|