stormcloud-video-player 0.5.7 → 0.5.9
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 +117 -25
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +2 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +117 -25
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +117 -25
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +2 -0
- package/lib/players/HlsPlayer.cjs +117 -25
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +117 -25
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/prebidController.cjs +4 -6
- package/lib/sdk/prebidController.cjs.map +1 -1
- package/lib/sdk/vastParser.cjs +3 -5
- package/lib/sdk/vastParser.cjs.map +1 -1
- package/lib/sdk/vastParser.d.cts +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +117 -25
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -708,8 +708,8 @@ function createEmptyTrackingState() {
|
|
|
708
708
|
complete: false
|
|
709
709
|
};
|
|
710
710
|
}
|
|
711
|
-
function fireTrackingPixels(urls, sessionId
|
|
712
|
-
var logPrefix = arguments.length >
|
|
711
|
+
function fireTrackingPixels(urls, sessionId) {
|
|
712
|
+
var logPrefix = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "[VastParser]";
|
|
713
713
|
if (!urls || urls.length === 0) return;
|
|
714
714
|
urls.forEach(function(url) {
|
|
715
715
|
try {
|
|
@@ -717,10 +717,8 @@ function fireTrackingPixels(urls, sessionId, licenseKey) {
|
|
|
717
717
|
if (sessionId) {
|
|
718
718
|
trackingUrl = "".concat(trackingUrl).concat(trackingUrl.includes("?") ? "&" : "?", "session_id=").concat(sessionId);
|
|
719
719
|
}
|
|
720
|
-
if (licenseKey) {
|
|
721
|
-
trackingUrl = "".concat(trackingUrl).concat(trackingUrl.includes("?") ? "&" : "?", "license_key=").concat(licenseKey);
|
|
722
|
-
}
|
|
723
720
|
var img = new Image(1, 1);
|
|
721
|
+
img.onerror = function() {};
|
|
724
722
|
img.src = trackingUrl;
|
|
725
723
|
console.log("".concat(logPrefix, " Fired tracking pixel: ").concat(trackingUrl));
|
|
726
724
|
} catch (error) {
|
|
@@ -1121,7 +1119,7 @@ function createPrebidController(contentVideo, options) {
|
|
|
1121
1119
|
return "session-".concat(Date.now(), "-").concat(Math.random().toString(36).substr(2, 9));
|
|
1122
1120
|
}
|
|
1123
1121
|
function fireTrackingPixels2(urls) {
|
|
1124
|
-
fireTrackingPixels(urls, sessionId,
|
|
1122
|
+
fireTrackingPixels(urls, sessionId, LOG);
|
|
1125
1123
|
}
|
|
1126
1124
|
function getMainStreamQuality() {
|
|
1127
1125
|
if (!mainHlsInstance || !mainHlsInstance.levels) {
|
|
@@ -2883,6 +2881,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
2883
2881
|
this.totalAdRequestsInBreak = 0;
|
|
2884
2882
|
this.maxTotalAdRequestsPerBreak = 20;
|
|
2885
2883
|
this.pendingAdBreak = null;
|
|
2884
|
+
this.prefetchAdPromise = null;
|
|
2885
|
+
this.savedMutedStateBeforeScte = null;
|
|
2886
2886
|
this.consecutiveFailures = 0;
|
|
2887
2887
|
this.maxConsecutiveFailures = 5;
|
|
2888
2888
|
this.lastAdRequestTime = 0;
|
|
@@ -3358,6 +3358,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3358
3358
|
}
|
|
3359
3359
|
}
|
|
3360
3360
|
console.error("[AD-ERROR]", errorMessage, errorPayload || "");
|
|
3361
|
+
_this.adController.stop().catch(function() {});
|
|
3361
3362
|
_this.handleAdFailure();
|
|
3362
3363
|
});
|
|
3363
3364
|
this.adController.on("content_pause", function() {
|
|
@@ -3400,6 +3401,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3400
3401
|
_this.activeAdRequestToken = null;
|
|
3401
3402
|
_this.showAds = false;
|
|
3402
3403
|
if (!_this.inAdBreak) {
|
|
3404
|
+
if (_this.config.debugAdTiming) {
|
|
3405
|
+
console.log("[StormcloudVideoPlayer] content_resume: break already ended (e.g. by CUE-IN or handleAdPodComplete), skipping next-ad path");
|
|
3406
|
+
}
|
|
3403
3407
|
return;
|
|
3404
3408
|
}
|
|
3405
3409
|
_this.consecutiveFailures = 0;
|
|
@@ -3412,6 +3416,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3412
3416
|
if (remaining > 500) {
|
|
3413
3417
|
_this.tryNextAvailableAdWithRateLimit();
|
|
3414
3418
|
} else {
|
|
3419
|
+
if (_this.config.debugAdTiming) {
|
|
3420
|
+
console.log("[StormcloudVideoPlayer] content_resume: remaining time too low to try next ad, ending ad pod");
|
|
3421
|
+
}
|
|
3415
3422
|
_this.handleAdPodComplete();
|
|
3416
3423
|
}
|
|
3417
3424
|
});
|
|
@@ -3420,6 +3427,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3420
3427
|
{
|
|
3421
3428
|
key: "recreateAdController",
|
|
3422
3429
|
value: function recreateAdController() {
|
|
3430
|
+
this.prefetchAdPromise = null;
|
|
3423
3431
|
var shouldShowPlaceholder = this.inAdBreak && this.showAds;
|
|
3424
3432
|
if (shouldShowPlaceholder && this.adController) {
|
|
3425
3433
|
this.showPlaceholderLayer();
|
|
@@ -3748,6 +3756,11 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3748
3756
|
if (marker.type === "start") {
|
|
3749
3757
|
var _this_config_immediateManifestAds;
|
|
3750
3758
|
var _this_pendingAdBreak;
|
|
3759
|
+
this.savedMutedStateBeforeScte = {
|
|
3760
|
+
muted: this.video.muted,
|
|
3761
|
+
volume: this.video.volume
|
|
3762
|
+
};
|
|
3763
|
+
this.adController.updateOriginalMutedState(this.video.muted, this.video.volume);
|
|
3751
3764
|
if (!this.video.muted) {
|
|
3752
3765
|
this.video.muted = true;
|
|
3753
3766
|
this.video.volume = 0;
|
|
@@ -3870,9 +3883,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3870
3883
|
activeAdRequest: this.activeAdRequestToken !== null
|
|
3871
3884
|
});
|
|
3872
3885
|
}
|
|
3873
|
-
if (adPlaying || remaining >
|
|
3886
|
+
if (adPlaying || remaining > 500) {
|
|
3874
3887
|
if (this.config.debugAdTiming) {
|
|
3875
|
-
console.log("[StormcloudVideoPlayer] Ignoring premature SCTE-35 end marker - ads still active");
|
|
3888
|
+
console.log("[StormcloudVideoPlayer] Ignoring premature SCTE-35 end marker - ads still active or time remaining");
|
|
3876
3889
|
}
|
|
3877
3890
|
return;
|
|
3878
3891
|
}
|
|
@@ -4189,6 +4202,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4189
4202
|
{
|
|
4190
4203
|
key: "startAdPrefetch",
|
|
4191
4204
|
value: function startAdPrefetch(marker, fragmentSn) {
|
|
4205
|
+
var _this = this;
|
|
4192
4206
|
if (this.pendingAdBreak || this.inAdBreak) {
|
|
4193
4207
|
return;
|
|
4194
4208
|
}
|
|
@@ -4200,8 +4214,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4200
4214
|
isFetching: false,
|
|
4201
4215
|
fetchStartTime: Date.now()
|
|
4202
4216
|
});
|
|
4217
|
+
this.prefetchAdPromise = this.adController.requestAds().catch(function() {
|
|
4218
|
+
if (_this.config.debugAdTiming) {
|
|
4219
|
+
console.log("[PREFETCH] Prebid auction prefetch failed, will request at playback time");
|
|
4220
|
+
}
|
|
4221
|
+
});
|
|
4203
4222
|
if (this.config.debugAdTiming) {
|
|
4204
|
-
console.log("[PREFETCH] Ad break marker registered, auction
|
|
4223
|
+
console.log("[PREFETCH] Ad break marker registered, auction prefetch started");
|
|
4205
4224
|
}
|
|
4206
4225
|
}
|
|
4207
4226
|
},
|
|
@@ -4212,6 +4231,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4212
4231
|
clearTimeout(this.prefetchTimerId);
|
|
4213
4232
|
this.prefetchTimerId = void 0;
|
|
4214
4233
|
}
|
|
4234
|
+
this.prefetchAdPromise = null;
|
|
4215
4235
|
this.pendingAdBreak = null;
|
|
4216
4236
|
}
|
|
4217
4237
|
},
|
|
@@ -4219,7 +4239,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4219
4239
|
key: "handleAdStart",
|
|
4220
4240
|
value: function handleAdStart(_marker) {
|
|
4221
4241
|
return _async_to_generator(function() {
|
|
4222
|
-
var adBreakDurationMs, mode,
|
|
4242
|
+
var _this_savedMutedStateBeforeScte, adBreakDurationMs, mode, state, unused, unused1, adLoadedInfo, adVolume, error;
|
|
4223
4243
|
return _ts_generator(this, function(_state) {
|
|
4224
4244
|
switch(_state.label){
|
|
4225
4245
|
case 0:
|
|
@@ -4232,9 +4252,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4232
4252
|
this.continuousFetchingActive = true;
|
|
4233
4253
|
this.isShowingPlaceholder = false;
|
|
4234
4254
|
this.totalAdRequestsInBreak = 0;
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4255
|
+
state = (_this_savedMutedStateBeforeScte = this.savedMutedStateBeforeScte) !== null && _this_savedMutedStateBeforeScte !== void 0 ? _this_savedMutedStateBeforeScte : {
|
|
4256
|
+
muted: this.video.muted,
|
|
4257
|
+
volume: this.video.volume
|
|
4258
|
+
};
|
|
4259
|
+
this.adController.updateOriginalMutedState(state.muted, state.volume);
|
|
4260
|
+
this.savedMutedStateBeforeScte = null;
|
|
4238
4261
|
if (!this.video.muted) {
|
|
4239
4262
|
this.video.muted = true;
|
|
4240
4263
|
this.video.volume = 0;
|
|
@@ -4253,25 +4276,94 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4253
4276
|
if (this.expectedAdBreakDurationMs == null && adBreakDurationMs != null) {
|
|
4254
4277
|
this.expectedAdBreakDurationMs = adBreakDurationMs;
|
|
4255
4278
|
}
|
|
4256
|
-
this.clearPendingAdBreak();
|
|
4257
4279
|
if (this.config.debugAdTiming) {
|
|
4258
|
-
console.log("[CONTINUOUS-FETCH] \uD83D\uDCCB Prebid auction
|
|
4280
|
+
console.log("[CONTINUOUS-FETCH] \uD83D\uDCCB Prebid auction (prefetch or requestAds)");
|
|
4259
4281
|
}
|
|
4260
4282
|
_state.label = 1;
|
|
4261
4283
|
case 1:
|
|
4262
4284
|
_state.trys.push([
|
|
4263
4285
|
1,
|
|
4264
|
-
|
|
4286
|
+
6,
|
|
4265
4287
|
,
|
|
4266
|
-
|
|
4288
|
+
12
|
|
4267
4289
|
]);
|
|
4268
4290
|
this.lastAdRequestTime = Date.now();
|
|
4291
|
+
if (!this.prefetchAdPromise) return [
|
|
4292
|
+
3,
|
|
4293
|
+
3
|
|
4294
|
+
];
|
|
4269
4295
|
return [
|
|
4270
4296
|
4,
|
|
4271
|
-
this.
|
|
4297
|
+
this.prefetchAdPromise
|
|
4272
4298
|
];
|
|
4273
4299
|
case 2:
|
|
4274
4300
|
_state.sent();
|
|
4301
|
+
this.prefetchAdPromise = null;
|
|
4302
|
+
return [
|
|
4303
|
+
3,
|
|
4304
|
+
5
|
|
4305
|
+
];
|
|
4306
|
+
case 3:
|
|
4307
|
+
return [
|
|
4308
|
+
4,
|
|
4309
|
+
this.adController.requestAds()
|
|
4310
|
+
];
|
|
4311
|
+
case 4:
|
|
4312
|
+
_state.sent();
|
|
4313
|
+
_state.label = 5;
|
|
4314
|
+
case 5:
|
|
4315
|
+
return [
|
|
4316
|
+
3,
|
|
4317
|
+
12
|
|
4318
|
+
];
|
|
4319
|
+
case 6:
|
|
4320
|
+
unused = _state.sent();
|
|
4321
|
+
_state.label = 7;
|
|
4322
|
+
case 7:
|
|
4323
|
+
_state.trys.push([
|
|
4324
|
+
7,
|
|
4325
|
+
9,
|
|
4326
|
+
,
|
|
4327
|
+
11
|
|
4328
|
+
]);
|
|
4329
|
+
return [
|
|
4330
|
+
4,
|
|
4331
|
+
this.adController.requestAds()
|
|
4332
|
+
];
|
|
4333
|
+
case 8:
|
|
4334
|
+
_state.sent();
|
|
4335
|
+
return [
|
|
4336
|
+
3,
|
|
4337
|
+
11
|
|
4338
|
+
];
|
|
4339
|
+
case 9:
|
|
4340
|
+
unused1 = _state.sent();
|
|
4341
|
+
this.clearPendingAdBreak();
|
|
4342
|
+
this.consecutiveFailures++;
|
|
4343
|
+
return [
|
|
4344
|
+
4,
|
|
4345
|
+
this.tryNextAvailableAdWithRateLimit()
|
|
4346
|
+
];
|
|
4347
|
+
case 10:
|
|
4348
|
+
_state.sent();
|
|
4349
|
+
return [
|
|
4350
|
+
2
|
|
4351
|
+
];
|
|
4352
|
+
case 11:
|
|
4353
|
+
return [
|
|
4354
|
+
3,
|
|
4355
|
+
12
|
|
4356
|
+
];
|
|
4357
|
+
case 12:
|
|
4358
|
+
this.clearPendingAdBreak();
|
|
4359
|
+
_state.label = 13;
|
|
4360
|
+
case 13:
|
|
4361
|
+
_state.trys.push([
|
|
4362
|
+
13,
|
|
4363
|
+
15,
|
|
4364
|
+
,
|
|
4365
|
+
17
|
|
4366
|
+
]);
|
|
4275
4367
|
if (this.config.licenseKey) {
|
|
4276
4368
|
adLoadedInfo = {
|
|
4277
4369
|
source: this.getAdSource(),
|
|
@@ -4288,19 +4380,19 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4288
4380
|
4,
|
|
4289
4381
|
this.adController.play()
|
|
4290
4382
|
];
|
|
4291
|
-
case
|
|
4383
|
+
case 14:
|
|
4292
4384
|
_state.sent();
|
|
4293
4385
|
if (this.expectedAdBreakDurationMs != null) {
|
|
4294
4386
|
this.currentAdBreakStartWallClockMs = Date.now();
|
|
4295
4387
|
this.scheduleAdStopCountdown(this.expectedAdBreakDurationMs);
|
|
4296
4388
|
}
|
|
4297
|
-
adVolume =
|
|
4389
|
+
adVolume = state.muted ? 0 : state.volume;
|
|
4298
4390
|
this.adController.setAdVolume(adVolume);
|
|
4299
4391
|
return [
|
|
4300
4392
|
3,
|
|
4301
|
-
|
|
4393
|
+
17
|
|
4302
4394
|
];
|
|
4303
|
-
case
|
|
4395
|
+
case 15:
|
|
4304
4396
|
error = _state.sent();
|
|
4305
4397
|
if (this.config.debugAdTiming) {
|
|
4306
4398
|
console.warn("[CONTINUOUS-FETCH] \u26A0\uFE0F First ad request failed:", error);
|
|
@@ -4310,13 +4402,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4310
4402
|
4,
|
|
4311
4403
|
this.tryNextAvailableAdWithRateLimit()
|
|
4312
4404
|
];
|
|
4313
|
-
case
|
|
4405
|
+
case 16:
|
|
4314
4406
|
_state.sent();
|
|
4315
4407
|
return [
|
|
4316
4408
|
3,
|
|
4317
|
-
|
|
4409
|
+
17
|
|
4318
4410
|
];
|
|
4319
|
-
case
|
|
4411
|
+
case 17:
|
|
4320
4412
|
return [
|
|
4321
4413
|
2
|
|
4322
4414
|
];
|