stormcloud-video-player 0.3.64 → 0.3.66
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 +87 -45
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +25 -19
- package/lib/index.d.ts +25 -19
- package/lib/index.js +87 -45
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +90 -45
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +6 -0
- package/lib/players/HlsPlayer.cjs +90 -45
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +90 -45
- package/lib/players/index.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +90 -45
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -4122,7 +4122,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4122
4122
|
_this.showAds = true;
|
|
4123
4123
|
_this.resetGamNoFillCounter();
|
|
4124
4124
|
if (_this.inAdBreak && _this.expectedAdBreakDurationMs != null && _this.adStopTimerId == null) {
|
|
4125
|
-
_this.
|
|
4125
|
+
_this.scheduleAdStopAtBreakBoundary();
|
|
4126
4126
|
if (_this.config.debugAdTiming) {
|
|
4127
4127
|
console.log("[StormcloudVideoPlayer] Starting ad break timer on content_pause (first ad starting)");
|
|
4128
4128
|
}
|
|
@@ -4766,12 +4766,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4766
4766
|
if (marker.durationSeconds != null) {
|
|
4767
4767
|
var newDurationMs = marker.durationSeconds * 1e3;
|
|
4768
4768
|
if (this.expectedAdBreakDurationMs == null || newDurationMs > this.expectedAdBreakDurationMs) {
|
|
4769
|
-
this.
|
|
4770
|
-
|
|
4771
|
-
var remainingMs = Math.max(0, newDurationMs - elapsedMs);
|
|
4772
|
-
this.scheduleAdStopCountdown(remainingMs);
|
|
4769
|
+
this.setAdBreakDurationBoundary(newDurationMs);
|
|
4770
|
+
this.scheduleAdStopAtBreakBoundary();
|
|
4773
4771
|
if (this.config.debugAdTiming) {
|
|
4774
|
-
console.log("[StormcloudVideoPlayer] Updated ad break duration from subsequent marker: ".concat(newDurationMs, "ms, remaining: ").concat(
|
|
4772
|
+
console.log("[StormcloudVideoPlayer] Updated ad break duration from subsequent marker: ".concat(newDurationMs, "ms, remaining: ").concat(this.getRemainingAdMs(), "ms"));
|
|
4775
4773
|
}
|
|
4776
4774
|
}
|
|
4777
4775
|
}
|
|
@@ -4845,13 +4843,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4845
4843
|
}
|
|
4846
4844
|
if (marker.type === "progress" && this.inAdBreak) {
|
|
4847
4845
|
if (marker.durationSeconds != null) {
|
|
4848
|
-
this.
|
|
4849
|
-
}
|
|
4850
|
-
if (this.expectedAdBreakDurationMs != null && this.currentAdBreakStartWallClockMs != null) {
|
|
4851
|
-
var elapsedMs1 = Date.now() - this.currentAdBreakStartWallClockMs;
|
|
4852
|
-
var remainingMs1 = Math.max(0, this.expectedAdBreakDurationMs - elapsedMs1);
|
|
4853
|
-
this.scheduleAdStopCountdown(remainingMs1);
|
|
4846
|
+
this.setAdBreakDurationBoundary(marker.durationSeconds * 1e3);
|
|
4854
4847
|
}
|
|
4848
|
+
this.scheduleAdStopAtBreakBoundary();
|
|
4855
4849
|
if (!this.ima.isAdPlaying() && this.activeAdRequestToken === null && this.adRequestQueue.length > 0) {
|
|
4856
4850
|
this.tryNextAvailableAdWithRateLimit();
|
|
4857
4851
|
}
|
|
@@ -4876,15 +4870,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4876
4870
|
activeAdRequest: this.activeAdRequestToken !== null
|
|
4877
4871
|
});
|
|
4878
4872
|
}
|
|
4879
|
-
|
|
4880
|
-
if (this.config.debugAdTiming) {
|
|
4881
|
-
console.log("[StormcloudVideoPlayer] Ignoring premature SCTE-35 end marker - ads still active");
|
|
4882
|
-
}
|
|
4883
|
-
return;
|
|
4884
|
-
}
|
|
4885
|
-
this.inAdBreak = false;
|
|
4886
|
-
this.expectedAdBreakDurationMs = void 0;
|
|
4887
|
-
this.currentAdBreakStartWallClockMs = void 0;
|
|
4873
|
+
this.scteAdBreakEndWallClockMs = Date.now();
|
|
4888
4874
|
this.clearAdStartTimer();
|
|
4889
4875
|
this.clearAdStopTimer();
|
|
4890
4876
|
if (adPlaying) {
|
|
@@ -4908,12 +4894,46 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4908
4894
|
this.inAdBreak = true;
|
|
4909
4895
|
this.activeScte35BreakKey = cueKey !== null && cueKey !== void 0 ? cueKey : this.pendingScte35CueKey;
|
|
4910
4896
|
this.scheduledScte35BreakKey = void 0;
|
|
4911
|
-
this.
|
|
4912
|
-
this.
|
|
4897
|
+
this.currentAdBreakStartWallClockMs = this.resolveScteBreakStartWallClockMs(marker);
|
|
4898
|
+
this.setAdBreakDurationBoundary(durationMs);
|
|
4913
4899
|
this.handleAdStart(marker);
|
|
4914
|
-
|
|
4915
|
-
|
|
4900
|
+
this.scheduleAdStopAtBreakBoundary();
|
|
4901
|
+
}
|
|
4902
|
+
},
|
|
4903
|
+
{
|
|
4904
|
+
key: "resolveScteBreakStartWallClockMs",
|
|
4905
|
+
value: function resolveScteBreakStartWallClockMs(marker) {
|
|
4906
|
+
var nowWallClockMs = Date.now();
|
|
4907
|
+
if (typeof marker.ptsSeconds !== "number") {
|
|
4908
|
+
return nowWallClockMs;
|
|
4909
|
+
}
|
|
4910
|
+
var nowMs = this.video.currentTime * 1e3;
|
|
4911
|
+
var estimatedCurrentPtsMs = nowMs - this.ptsDriftEmaMs;
|
|
4912
|
+
var deltaMs = marker.ptsSeconds * 1e3 - estimatedCurrentPtsMs;
|
|
4913
|
+
if (!Number.isFinite(deltaMs)) {
|
|
4914
|
+
return nowWallClockMs;
|
|
4915
|
+
}
|
|
4916
|
+
return nowWallClockMs + Math.floor(deltaMs);
|
|
4917
|
+
}
|
|
4918
|
+
},
|
|
4919
|
+
{
|
|
4920
|
+
key: "setAdBreakDurationBoundary",
|
|
4921
|
+
value: function setAdBreakDurationBoundary(durationMs) {
|
|
4922
|
+
this.expectedAdBreakDurationMs = durationMs;
|
|
4923
|
+
if (durationMs != null && this.currentAdBreakStartWallClockMs != null) {
|
|
4924
|
+
this.scteAdBreakEndWallClockMs = this.currentAdBreakStartWallClockMs + durationMs;
|
|
4925
|
+
} else {
|
|
4926
|
+
this.scteAdBreakEndWallClockMs = void 0;
|
|
4927
|
+
}
|
|
4928
|
+
}
|
|
4929
|
+
},
|
|
4930
|
+
{
|
|
4931
|
+
key: "scheduleAdStopAtBreakBoundary",
|
|
4932
|
+
value: function scheduleAdStopAtBreakBoundary() {
|
|
4933
|
+
if (this.expectedAdBreakDurationMs == null) {
|
|
4934
|
+
return;
|
|
4916
4935
|
}
|
|
4936
|
+
this.scheduleAdStopCountdown(this.getRemainingAdMs());
|
|
4917
4937
|
}
|
|
4918
4938
|
},
|
|
4919
4939
|
{
|
|
@@ -5639,6 +5659,20 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5639
5659
|
return !!(this.config.isVmap && ((_this_config_vmapUrl = this.config.vmapUrl) === null || _this_config_vmapUrl === void 0 ? void 0 : _this_config_vmapUrl.trim()));
|
|
5640
5660
|
}
|
|
5641
5661
|
},
|
|
5662
|
+
{
|
|
5663
|
+
key: "applyMqttConfigFromResponse",
|
|
5664
|
+
value: function applyMqttConfigFromResponse(data) {
|
|
5665
|
+
var _data_response;
|
|
5666
|
+
var mqttConfig2 = (_data_response = data.response) === null || _data_response === void 0 ? void 0 : _data_response.mqtt_config;
|
|
5667
|
+
if (!mqttConfig2 || (typeof mqttConfig2 === "undefined" ? "undefined" : _type_of(mqttConfig2)) !== "object") {
|
|
5668
|
+
return;
|
|
5669
|
+
}
|
|
5670
|
+
applyMQTTConfig(mqttConfig2);
|
|
5671
|
+
if (this.config.debugAdTiming) {
|
|
5672
|
+
console.log("[StormcloudVideoPlayer] Applied MQTT config from /ads/web:", mqttConfig2);
|
|
5673
|
+
}
|
|
5674
|
+
}
|
|
5675
|
+
},
|
|
5642
5676
|
{
|
|
5643
5677
|
key: "fetchAdConfiguration",
|
|
5644
5678
|
value: function fetchAdConfiguration() {
|
|
@@ -5725,6 +5759,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5725
5759
|
];
|
|
5726
5760
|
case 4:
|
|
5727
5761
|
data = _state.sent();
|
|
5762
|
+
this.applyMqttConfigFromResponse(data);
|
|
5728
5763
|
imaPayload = (_data_response = data.response) === null || _data_response === void 0 ? void 0 : (_data_response_ima = _data_response.ima) === null || _data_response_ima === void 0 ? void 0 : (_data_response_ima_publisherdeskima = _data_response_ima["publisherdesk.ima"]) === null || _data_response_ima_publisherdeskima === void 0 ? void 0 : _data_response_ima_publisherdeskima.payload;
|
|
5729
5764
|
if (imaPayload) {
|
|
5730
5765
|
this.apiVastTagUrl = decodeURIComponent(imaPayload);
|
|
@@ -6541,7 +6576,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6541
6576
|
}
|
|
6542
6577
|
}
|
|
6543
6578
|
this.inAdBreak = true;
|
|
6544
|
-
this.currentAdBreakStartWallClockMs = Date.now();
|
|
6545
6579
|
this.currentAdIndex = 0;
|
|
6546
6580
|
this.totalAdsInBreak = 1;
|
|
6547
6581
|
this.adPodQueue = [];
|
|
@@ -6628,7 +6662,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6628
6662
|
case 2:
|
|
6629
6663
|
_state.sent();
|
|
6630
6664
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
6631
|
-
this.
|
|
6665
|
+
this.scheduleAdStopAtBreakBoundary();
|
|
6632
6666
|
}
|
|
6633
6667
|
adVolume = currentMuted ? 0 : currentVolume;
|
|
6634
6668
|
this.ima.setAdVolume(adVolume);
|
|
@@ -6671,7 +6705,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6671
6705
|
case 6:
|
|
6672
6706
|
_state.sent();
|
|
6673
6707
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
6674
|
-
this.
|
|
6708
|
+
this.scheduleAdStopAtBreakBoundary();
|
|
6675
6709
|
}
|
|
6676
6710
|
adVolume1 = currentMuted ? 0 : currentVolume;
|
|
6677
6711
|
this.ima.setAdVolume(adVolume1);
|
|
@@ -6726,7 +6760,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6726
6760
|
case 10:
|
|
6727
6761
|
_state.sent();
|
|
6728
6762
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
6729
|
-
this.
|
|
6763
|
+
this.scheduleAdStopAtBreakBoundary();
|
|
6730
6764
|
}
|
|
6731
6765
|
adVolume2 = currentMuted ? 0 : currentVolume;
|
|
6732
6766
|
this.ima.setAdVolume(adVolume2);
|
|
@@ -7078,7 +7112,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7078
7112
|
case 2:
|
|
7079
7113
|
_state.sent();
|
|
7080
7114
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
7081
|
-
this.
|
|
7115
|
+
this.scheduleAdStopAtBreakBoundary();
|
|
7082
7116
|
}
|
|
7083
7117
|
currentMuted = this.video.muted;
|
|
7084
7118
|
currentVolume = this.video.volume;
|
|
@@ -7578,21 +7612,16 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7578
7612
|
{
|
|
7579
7613
|
key: "ensureAdStoppedByTimer",
|
|
7580
7614
|
value: function ensureAdStoppedByTimer() {
|
|
7581
|
-
var _this_config_adBreakCheckIntervalMs,
|
|
7615
|
+
var _this_config_adBreakCheckIntervalMs, _this_getAdBreakEndWallClockMs;
|
|
7582
7616
|
if (!this.inAdBreak) return;
|
|
7583
7617
|
this.adStopTimerId = void 0;
|
|
7584
7618
|
var adPlaying = this.ima.isAdPlaying();
|
|
7585
|
-
var pendingAds = this.adPodQueue.length > 0;
|
|
7586
7619
|
var checkIntervalMs = Math.max(250, Math.floor((_this_config_adBreakCheckIntervalMs = this.config.adBreakCheckIntervalMs) !== null && _this_config_adBreakCheckIntervalMs !== void 0 ? _this_config_adBreakCheckIntervalMs : 1e3));
|
|
7587
7620
|
var maxExtensionMsConfig = this.config.maxAdBreakExtensionMs;
|
|
7588
|
-
var maxExtensionMs = typeof maxExtensionMsConfig === "number" && maxExtensionMsConfig > 0 ? maxExtensionMsConfig :
|
|
7589
|
-
var
|
|
7590
|
-
|
|
7591
|
-
|
|
7592
|
-
}
|
|
7593
|
-
var expectedDurationMs = (_this_expectedAdBreakDurationMs = this.expectedAdBreakDurationMs) !== null && _this_expectedAdBreakDurationMs !== void 0 ? _this_expectedAdBreakDurationMs : 0;
|
|
7594
|
-
var overrunMs = Math.max(0, elapsedSinceStartMs - expectedDurationMs);
|
|
7595
|
-
var shouldExtendAdBreak = (adPlaying || pendingAds || this.showAds) && overrunMs < maxExtensionMs;
|
|
7621
|
+
var maxExtensionMs = typeof maxExtensionMsConfig === "number" && maxExtensionMsConfig > 0 ? maxExtensionMsConfig : 0;
|
|
7622
|
+
var endWallClockMs = (_this_getAdBreakEndWallClockMs = this.getAdBreakEndWallClockMs()) !== null && _this_getAdBreakEndWallClockMs !== void 0 ? _this_getAdBreakEndWallClockMs : Date.now();
|
|
7623
|
+
var overrunMs = Math.max(0, Date.now() - endWallClockMs);
|
|
7624
|
+
var shouldExtendAdBreak = adPlaying && overrunMs < maxExtensionMs;
|
|
7596
7625
|
if (shouldExtendAdBreak) {
|
|
7597
7626
|
this.scheduleAdStopCountdown(checkIntervalMs);
|
|
7598
7627
|
return;
|
|
@@ -7858,7 +7887,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7858
7887
|
case 5:
|
|
7859
7888
|
_state.sent();
|
|
7860
7889
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
7861
|
-
this.
|
|
7890
|
+
this.scheduleAdStopAtBreakBoundary();
|
|
7862
7891
|
}
|
|
7863
7892
|
currentMuted = this.video.muted;
|
|
7864
7893
|
currentVolume = this.video.volume;
|
|
@@ -7908,7 +7937,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7908
7937
|
case 8:
|
|
7909
7938
|
_state.sent();
|
|
7910
7939
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
7911
|
-
this.
|
|
7940
|
+
this.scheduleAdStopAtBreakBoundary();
|
|
7912
7941
|
}
|
|
7913
7942
|
currentMuted1 = this.video.muted;
|
|
7914
7943
|
currentVolume1 = this.video.volume;
|
|
@@ -8053,6 +8082,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8053
8082
|
this.scheduledScte35BreakKey = void 0;
|
|
8054
8083
|
this.expectedAdBreakDurationMs = void 0;
|
|
8055
8084
|
this.currentAdBreakStartWallClockMs = void 0;
|
|
8085
|
+
this.scteAdBreakEndWallClockMs = void 0;
|
|
8056
8086
|
this.clearAdStartTimer();
|
|
8057
8087
|
this.clearAdStopTimer();
|
|
8058
8088
|
this.adPodQueue = [];
|
|
@@ -8242,9 +8272,21 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8242
8272
|
{
|
|
8243
8273
|
key: "getRemainingAdMs",
|
|
8244
8274
|
value: function getRemainingAdMs() {
|
|
8245
|
-
|
|
8246
|
-
|
|
8247
|
-
|
|
8275
|
+
var endWallClockMs = this.getAdBreakEndWallClockMs();
|
|
8276
|
+
if (endWallClockMs != null) {
|
|
8277
|
+
return Math.max(0, endWallClockMs - Date.now());
|
|
8278
|
+
}
|
|
8279
|
+
return 0;
|
|
8280
|
+
}
|
|
8281
|
+
},
|
|
8282
|
+
{
|
|
8283
|
+
key: "getAdBreakEndWallClockMs",
|
|
8284
|
+
value: function getAdBreakEndWallClockMs() {
|
|
8285
|
+
if (this.scteAdBreakEndWallClockMs != null) {
|
|
8286
|
+
return this.scteAdBreakEndWallClockMs;
|
|
8287
|
+
}
|
|
8288
|
+
if (this.expectedAdBreakDurationMs == null || this.currentAdBreakStartWallClockMs == null) return void 0;
|
|
8289
|
+
return this.currentAdBreakStartWallClockMs + this.expectedAdBreakDurationMs;
|
|
8248
8290
|
}
|
|
8249
8291
|
},
|
|
8250
8292
|
{
|