stormcloud-video-player 0.3.64 → 0.3.65
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 +2 -2
- package/lib/index.cjs +72 -45
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +5 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.js +72 -45
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +72 -45
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +5 -0
- package/lib/players/HlsPlayer.cjs +72 -45
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +72 -45
- package/lib/players/index.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +72 -45
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/package.json +1 -1
|
@@ -3827,7 +3827,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3827
3827
|
_this.showAds = true;
|
|
3828
3828
|
_this.resetGamNoFillCounter();
|
|
3829
3829
|
if (_this.inAdBreak && _this.expectedAdBreakDurationMs != null && _this.adStopTimerId == null) {
|
|
3830
|
-
_this.
|
|
3830
|
+
_this.scheduleAdStopAtBreakBoundary();
|
|
3831
3831
|
if (_this.config.debugAdTiming) {
|
|
3832
3832
|
console.log("[StormcloudVideoPlayer] Starting ad break timer on content_pause (first ad starting)");
|
|
3833
3833
|
}
|
|
@@ -4471,12 +4471,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4471
4471
|
if (marker.durationSeconds != null) {
|
|
4472
4472
|
var newDurationMs = marker.durationSeconds * 1e3;
|
|
4473
4473
|
if (this.expectedAdBreakDurationMs == null || newDurationMs > this.expectedAdBreakDurationMs) {
|
|
4474
|
-
this.
|
|
4475
|
-
|
|
4476
|
-
var remainingMs = Math.max(0, newDurationMs - elapsedMs);
|
|
4477
|
-
this.scheduleAdStopCountdown(remainingMs);
|
|
4474
|
+
this.setAdBreakDurationBoundary(newDurationMs);
|
|
4475
|
+
this.scheduleAdStopAtBreakBoundary();
|
|
4478
4476
|
if (this.config.debugAdTiming) {
|
|
4479
|
-
console.log("[StormcloudVideoPlayer] Updated ad break duration from subsequent marker: ".concat(newDurationMs, "ms, remaining: ").concat(
|
|
4477
|
+
console.log("[StormcloudVideoPlayer] Updated ad break duration from subsequent marker: ".concat(newDurationMs, "ms, remaining: ").concat(this.getRemainingAdMs(), "ms"));
|
|
4480
4478
|
}
|
|
4481
4479
|
}
|
|
4482
4480
|
}
|
|
@@ -4550,13 +4548,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4550
4548
|
}
|
|
4551
4549
|
if (marker.type === "progress" && this.inAdBreak) {
|
|
4552
4550
|
if (marker.durationSeconds != null) {
|
|
4553
|
-
this.
|
|
4554
|
-
}
|
|
4555
|
-
if (this.expectedAdBreakDurationMs != null && this.currentAdBreakStartWallClockMs != null) {
|
|
4556
|
-
var elapsedMs1 = Date.now() - this.currentAdBreakStartWallClockMs;
|
|
4557
|
-
var remainingMs1 = Math.max(0, this.expectedAdBreakDurationMs - elapsedMs1);
|
|
4558
|
-
this.scheduleAdStopCountdown(remainingMs1);
|
|
4551
|
+
this.setAdBreakDurationBoundary(marker.durationSeconds * 1e3);
|
|
4559
4552
|
}
|
|
4553
|
+
this.scheduleAdStopAtBreakBoundary();
|
|
4560
4554
|
if (!this.ima.isAdPlaying() && this.activeAdRequestToken === null && this.adRequestQueue.length > 0) {
|
|
4561
4555
|
this.tryNextAvailableAdWithRateLimit();
|
|
4562
4556
|
}
|
|
@@ -4581,15 +4575,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4581
4575
|
activeAdRequest: this.activeAdRequestToken !== null
|
|
4582
4576
|
});
|
|
4583
4577
|
}
|
|
4584
|
-
|
|
4585
|
-
if (this.config.debugAdTiming) {
|
|
4586
|
-
console.log("[StormcloudVideoPlayer] Ignoring premature SCTE-35 end marker - ads still active");
|
|
4587
|
-
}
|
|
4588
|
-
return;
|
|
4589
|
-
}
|
|
4590
|
-
this.inAdBreak = false;
|
|
4591
|
-
this.expectedAdBreakDurationMs = void 0;
|
|
4592
|
-
this.currentAdBreakStartWallClockMs = void 0;
|
|
4578
|
+
this.scteAdBreakEndWallClockMs = Date.now();
|
|
4593
4579
|
this.clearAdStartTimer();
|
|
4594
4580
|
this.clearAdStopTimer();
|
|
4595
4581
|
if (adPlaying) {
|
|
@@ -4613,12 +4599,46 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4613
4599
|
this.inAdBreak = true;
|
|
4614
4600
|
this.activeScte35BreakKey = cueKey !== null && cueKey !== void 0 ? cueKey : this.pendingScte35CueKey;
|
|
4615
4601
|
this.scheduledScte35BreakKey = void 0;
|
|
4616
|
-
this.
|
|
4617
|
-
this.
|
|
4602
|
+
this.currentAdBreakStartWallClockMs = this.resolveScteBreakStartWallClockMs(marker);
|
|
4603
|
+
this.setAdBreakDurationBoundary(durationMs);
|
|
4618
4604
|
this.handleAdStart(marker);
|
|
4619
|
-
|
|
4620
|
-
|
|
4605
|
+
this.scheduleAdStopAtBreakBoundary();
|
|
4606
|
+
}
|
|
4607
|
+
},
|
|
4608
|
+
{
|
|
4609
|
+
key: "resolveScteBreakStartWallClockMs",
|
|
4610
|
+
value: function resolveScteBreakStartWallClockMs(marker) {
|
|
4611
|
+
var nowWallClockMs = Date.now();
|
|
4612
|
+
if (typeof marker.ptsSeconds !== "number") {
|
|
4613
|
+
return nowWallClockMs;
|
|
4621
4614
|
}
|
|
4615
|
+
var nowMs = this.video.currentTime * 1e3;
|
|
4616
|
+
var estimatedCurrentPtsMs = nowMs - this.ptsDriftEmaMs;
|
|
4617
|
+
var deltaMs = marker.ptsSeconds * 1e3 - estimatedCurrentPtsMs;
|
|
4618
|
+
if (!Number.isFinite(deltaMs)) {
|
|
4619
|
+
return nowWallClockMs;
|
|
4620
|
+
}
|
|
4621
|
+
return nowWallClockMs + Math.floor(deltaMs);
|
|
4622
|
+
}
|
|
4623
|
+
},
|
|
4624
|
+
{
|
|
4625
|
+
key: "setAdBreakDurationBoundary",
|
|
4626
|
+
value: function setAdBreakDurationBoundary(durationMs) {
|
|
4627
|
+
this.expectedAdBreakDurationMs = durationMs;
|
|
4628
|
+
if (durationMs != null && this.currentAdBreakStartWallClockMs != null) {
|
|
4629
|
+
this.scteAdBreakEndWallClockMs = this.currentAdBreakStartWallClockMs + durationMs;
|
|
4630
|
+
} else {
|
|
4631
|
+
this.scteAdBreakEndWallClockMs = void 0;
|
|
4632
|
+
}
|
|
4633
|
+
}
|
|
4634
|
+
},
|
|
4635
|
+
{
|
|
4636
|
+
key: "scheduleAdStopAtBreakBoundary",
|
|
4637
|
+
value: function scheduleAdStopAtBreakBoundary() {
|
|
4638
|
+
if (this.expectedAdBreakDurationMs == null) {
|
|
4639
|
+
return;
|
|
4640
|
+
}
|
|
4641
|
+
this.scheduleAdStopCountdown(this.getRemainingAdMs());
|
|
4622
4642
|
}
|
|
4623
4643
|
},
|
|
4624
4644
|
{
|
|
@@ -6246,7 +6266,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6246
6266
|
}
|
|
6247
6267
|
}
|
|
6248
6268
|
this.inAdBreak = true;
|
|
6249
|
-
this.currentAdBreakStartWallClockMs = Date.now();
|
|
6250
6269
|
this.currentAdIndex = 0;
|
|
6251
6270
|
this.totalAdsInBreak = 1;
|
|
6252
6271
|
this.adPodQueue = [];
|
|
@@ -6333,7 +6352,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6333
6352
|
case 2:
|
|
6334
6353
|
_state.sent();
|
|
6335
6354
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
6336
|
-
this.
|
|
6355
|
+
this.scheduleAdStopAtBreakBoundary();
|
|
6337
6356
|
}
|
|
6338
6357
|
adVolume = currentMuted ? 0 : currentVolume;
|
|
6339
6358
|
this.ima.setAdVolume(adVolume);
|
|
@@ -6376,7 +6395,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6376
6395
|
case 6:
|
|
6377
6396
|
_state.sent();
|
|
6378
6397
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
6379
|
-
this.
|
|
6398
|
+
this.scheduleAdStopAtBreakBoundary();
|
|
6380
6399
|
}
|
|
6381
6400
|
adVolume1 = currentMuted ? 0 : currentVolume;
|
|
6382
6401
|
this.ima.setAdVolume(adVolume1);
|
|
@@ -6431,7 +6450,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6431
6450
|
case 10:
|
|
6432
6451
|
_state.sent();
|
|
6433
6452
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
6434
|
-
this.
|
|
6453
|
+
this.scheduleAdStopAtBreakBoundary();
|
|
6435
6454
|
}
|
|
6436
6455
|
adVolume2 = currentMuted ? 0 : currentVolume;
|
|
6437
6456
|
this.ima.setAdVolume(adVolume2);
|
|
@@ -6783,7 +6802,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6783
6802
|
case 2:
|
|
6784
6803
|
_state.sent();
|
|
6785
6804
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
6786
|
-
this.
|
|
6805
|
+
this.scheduleAdStopAtBreakBoundary();
|
|
6787
6806
|
}
|
|
6788
6807
|
currentMuted = this.video.muted;
|
|
6789
6808
|
currentVolume = this.video.volume;
|
|
@@ -7283,21 +7302,16 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7283
7302
|
{
|
|
7284
7303
|
key: "ensureAdStoppedByTimer",
|
|
7285
7304
|
value: function ensureAdStoppedByTimer() {
|
|
7286
|
-
var _this_config_adBreakCheckIntervalMs,
|
|
7305
|
+
var _this_config_adBreakCheckIntervalMs, _this_getAdBreakEndWallClockMs;
|
|
7287
7306
|
if (!this.inAdBreak) return;
|
|
7288
7307
|
this.adStopTimerId = void 0;
|
|
7289
7308
|
var adPlaying = this.ima.isAdPlaying();
|
|
7290
|
-
var pendingAds = this.adPodQueue.length > 0;
|
|
7291
7309
|
var checkIntervalMs = Math.max(250, Math.floor((_this_config_adBreakCheckIntervalMs = this.config.adBreakCheckIntervalMs) !== null && _this_config_adBreakCheckIntervalMs !== void 0 ? _this_config_adBreakCheckIntervalMs : 1e3));
|
|
7292
7310
|
var maxExtensionMsConfig = this.config.maxAdBreakExtensionMs;
|
|
7293
|
-
var maxExtensionMs = typeof maxExtensionMsConfig === "number" && maxExtensionMsConfig > 0 ? maxExtensionMsConfig :
|
|
7294
|
-
var
|
|
7295
|
-
|
|
7296
|
-
|
|
7297
|
-
}
|
|
7298
|
-
var expectedDurationMs = (_this_expectedAdBreakDurationMs = this.expectedAdBreakDurationMs) !== null && _this_expectedAdBreakDurationMs !== void 0 ? _this_expectedAdBreakDurationMs : 0;
|
|
7299
|
-
var overrunMs = Math.max(0, elapsedSinceStartMs - expectedDurationMs);
|
|
7300
|
-
var shouldExtendAdBreak = (adPlaying || pendingAds || this.showAds) && overrunMs < maxExtensionMs;
|
|
7311
|
+
var maxExtensionMs = typeof maxExtensionMsConfig === "number" && maxExtensionMsConfig > 0 ? maxExtensionMsConfig : 0;
|
|
7312
|
+
var endWallClockMs = (_this_getAdBreakEndWallClockMs = this.getAdBreakEndWallClockMs()) !== null && _this_getAdBreakEndWallClockMs !== void 0 ? _this_getAdBreakEndWallClockMs : Date.now();
|
|
7313
|
+
var overrunMs = Math.max(0, Date.now() - endWallClockMs);
|
|
7314
|
+
var shouldExtendAdBreak = adPlaying && overrunMs < maxExtensionMs;
|
|
7301
7315
|
if (shouldExtendAdBreak) {
|
|
7302
7316
|
this.scheduleAdStopCountdown(checkIntervalMs);
|
|
7303
7317
|
return;
|
|
@@ -7563,7 +7577,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7563
7577
|
case 5:
|
|
7564
7578
|
_state.sent();
|
|
7565
7579
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
7566
|
-
this.
|
|
7580
|
+
this.scheduleAdStopAtBreakBoundary();
|
|
7567
7581
|
}
|
|
7568
7582
|
currentMuted = this.video.muted;
|
|
7569
7583
|
currentVolume = this.video.volume;
|
|
@@ -7613,7 +7627,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7613
7627
|
case 8:
|
|
7614
7628
|
_state.sent();
|
|
7615
7629
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
7616
|
-
this.
|
|
7630
|
+
this.scheduleAdStopAtBreakBoundary();
|
|
7617
7631
|
}
|
|
7618
7632
|
currentMuted1 = this.video.muted;
|
|
7619
7633
|
currentVolume1 = this.video.volume;
|
|
@@ -7758,6 +7772,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7758
7772
|
this.scheduledScte35BreakKey = void 0;
|
|
7759
7773
|
this.expectedAdBreakDurationMs = void 0;
|
|
7760
7774
|
this.currentAdBreakStartWallClockMs = void 0;
|
|
7775
|
+
this.scteAdBreakEndWallClockMs = void 0;
|
|
7761
7776
|
this.clearAdStartTimer();
|
|
7762
7777
|
this.clearAdStopTimer();
|
|
7763
7778
|
this.adPodQueue = [];
|
|
@@ -7947,9 +7962,21 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7947
7962
|
{
|
|
7948
7963
|
key: "getRemainingAdMs",
|
|
7949
7964
|
value: function getRemainingAdMs() {
|
|
7950
|
-
|
|
7951
|
-
|
|
7952
|
-
|
|
7965
|
+
var endWallClockMs = this.getAdBreakEndWallClockMs();
|
|
7966
|
+
if (endWallClockMs != null) {
|
|
7967
|
+
return Math.max(0, endWallClockMs - Date.now());
|
|
7968
|
+
}
|
|
7969
|
+
return 0;
|
|
7970
|
+
}
|
|
7971
|
+
},
|
|
7972
|
+
{
|
|
7973
|
+
key: "getAdBreakEndWallClockMs",
|
|
7974
|
+
value: function getAdBreakEndWallClockMs() {
|
|
7975
|
+
if (this.scteAdBreakEndWallClockMs != null) {
|
|
7976
|
+
return this.scteAdBreakEndWallClockMs;
|
|
7977
|
+
}
|
|
7978
|
+
if (this.expectedAdBreakDurationMs == null || this.currentAdBreakStartWallClockMs == null) return void 0;
|
|
7979
|
+
return this.currentAdBreakStartWallClockMs + this.expectedAdBreakDurationMs;
|
|
7953
7980
|
}
|
|
7954
7981
|
},
|
|
7955
7982
|
{
|