stormcloud-video-player 0.3.55 → 0.3.56
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 +271 -26
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +9 -0
- package/lib/index.d.ts +9 -0
- package/lib/index.js +271 -26
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +264 -25
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +8 -1
- package/lib/players/HlsPlayer.cjs +264 -25
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.d.cts +1 -1
- package/lib/players/index.cjs +264 -25
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.d.cts +1 -1
- package/lib/sdk/ima.d.cts +1 -1
- package/lib/{types-C23mJ_hh.d.cts → types-Vj55FghO.d.cts} +1 -0
- package/lib/ui/StormcloudVideoPlayer.cjs +269 -26
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.d.cts +1 -1
- package/lib/utils/tracking.d.cts +1 -1
- package/package.json +1 -1
package/lib/sdk/ima.d.cts
CHANGED
|
@@ -3239,6 +3239,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3239
3239
|
this.inAdBreak = false;
|
|
3240
3240
|
this.ptsDriftEmaMs = 0;
|
|
3241
3241
|
this.adPodQueue = [];
|
|
3242
|
+
this.vmapBreaks = [];
|
|
3243
|
+
this.consumedVmapBreakIds = /* @__PURE__ */ new Set();
|
|
3242
3244
|
this.lastHeartbeatTime = 0;
|
|
3243
3245
|
this.currentAdIndex = 0;
|
|
3244
3246
|
this.totalAdsInBreak = 0;
|
|
@@ -4567,6 +4569,18 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4567
4569
|
return _ts_generator(this, function(_state) {
|
|
4568
4570
|
switch(_state.label){
|
|
4569
4571
|
case 0:
|
|
4572
|
+
if (!this.config.vmapUrl) return [
|
|
4573
|
+
3,
|
|
4574
|
+
2
|
|
4575
|
+
];
|
|
4576
|
+
return [
|
|
4577
|
+
4,
|
|
4578
|
+
this.fetchAndParseVmap(this.config.vmapUrl)
|
|
4579
|
+
];
|
|
4580
|
+
case 1:
|
|
4581
|
+
_state.sent();
|
|
4582
|
+
_state.label = 2;
|
|
4583
|
+
case 2:
|
|
4570
4584
|
vastMode = this.config.vastMode || "default";
|
|
4571
4585
|
if (this.config.debugAdTiming) {
|
|
4572
4586
|
console.log("[StormcloudVideoPlayer] VAST mode:", vastMode);
|
|
@@ -4612,7 +4626,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4612
4626
|
headers: headers
|
|
4613
4627
|
})
|
|
4614
4628
|
];
|
|
4615
|
-
case
|
|
4629
|
+
case 3:
|
|
4616
4630
|
response = _state.sent();
|
|
4617
4631
|
if (!response.ok) {
|
|
4618
4632
|
if (this.config.debugAdTiming) {
|
|
@@ -4626,7 +4640,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4626
4640
|
4,
|
|
4627
4641
|
response.json()
|
|
4628
4642
|
];
|
|
4629
|
-
case
|
|
4643
|
+
case 4:
|
|
4630
4644
|
data = _state.sent();
|
|
4631
4645
|
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;
|
|
4632
4646
|
if (imaPayload) {
|
|
@@ -4654,6 +4668,171 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4654
4668
|
}).call(this);
|
|
4655
4669
|
}
|
|
4656
4670
|
},
|
|
4671
|
+
{
|
|
4672
|
+
key: "fetchAndParseVmap",
|
|
4673
|
+
value: function fetchAndParseVmap(vmapUrl) {
|
|
4674
|
+
return _async_to_generator(function() {
|
|
4675
|
+
var response, vmapXml, error;
|
|
4676
|
+
return _ts_generator(this, function(_state) {
|
|
4677
|
+
switch(_state.label){
|
|
4678
|
+
case 0:
|
|
4679
|
+
if (!vmapUrl.trim()) {
|
|
4680
|
+
return [
|
|
4681
|
+
2
|
|
4682
|
+
];
|
|
4683
|
+
}
|
|
4684
|
+
_state.label = 1;
|
|
4685
|
+
case 1:
|
|
4686
|
+
_state.trys.push([
|
|
4687
|
+
1,
|
|
4688
|
+
4,
|
|
4689
|
+
,
|
|
4690
|
+
5
|
|
4691
|
+
]);
|
|
4692
|
+
return [
|
|
4693
|
+
4,
|
|
4694
|
+
fetch(vmapUrl)
|
|
4695
|
+
];
|
|
4696
|
+
case 2:
|
|
4697
|
+
response = _state.sent();
|
|
4698
|
+
if (!response.ok) {
|
|
4699
|
+
throw new Error("Failed to fetch VMAP (".concat(response.status, ")"));
|
|
4700
|
+
}
|
|
4701
|
+
return [
|
|
4702
|
+
4,
|
|
4703
|
+
response.text()
|
|
4704
|
+
];
|
|
4705
|
+
case 3:
|
|
4706
|
+
vmapXml = _state.sent();
|
|
4707
|
+
this.vmapBreaks = this.parseVmapToBreaks(vmapXml);
|
|
4708
|
+
this.consumedVmapBreakIds.clear();
|
|
4709
|
+
if (this.config.debugAdTiming) {
|
|
4710
|
+
console.log("[StormcloudVideoPlayer] Loaded ".concat(this.vmapBreaks.length, " VMAP ad break(s) from:"), vmapUrl);
|
|
4711
|
+
}
|
|
4712
|
+
return [
|
|
4713
|
+
3,
|
|
4714
|
+
5
|
|
4715
|
+
];
|
|
4716
|
+
case 4:
|
|
4717
|
+
error = _state.sent();
|
|
4718
|
+
this.vmapBreaks = [];
|
|
4719
|
+
this.consumedVmapBreakIds.clear();
|
|
4720
|
+
if (this.config.debugAdTiming) {
|
|
4721
|
+
console.warn("[StormcloudVideoPlayer] Failed to load VMAP:", error);
|
|
4722
|
+
}
|
|
4723
|
+
return [
|
|
4724
|
+
3,
|
|
4725
|
+
5
|
|
4726
|
+
];
|
|
4727
|
+
case 5:
|
|
4728
|
+
return [
|
|
4729
|
+
2
|
|
4730
|
+
];
|
|
4731
|
+
}
|
|
4732
|
+
});
|
|
4733
|
+
}).call(this);
|
|
4734
|
+
}
|
|
4735
|
+
},
|
|
4736
|
+
{
|
|
4737
|
+
key: "parseVmapToBreaks",
|
|
4738
|
+
value: function parseVmapToBreaks(vmapXml) {
|
|
4739
|
+
var _this = this;
|
|
4740
|
+
if (typeof DOMParser === "undefined") {
|
|
4741
|
+
return [];
|
|
4742
|
+
}
|
|
4743
|
+
var doc = new DOMParser().parseFromString(vmapXml, "application/xml");
|
|
4744
|
+
if (doc.querySelector("parsererror")) {
|
|
4745
|
+
if (this.config.debugAdTiming) {
|
|
4746
|
+
console.warn("[StormcloudVideoPlayer] Invalid VMAP XML received");
|
|
4747
|
+
}
|
|
4748
|
+
return [];
|
|
4749
|
+
}
|
|
4750
|
+
var adBreakNodes = Array.from(doc.querySelectorAll("AdBreak, vmap\\:AdBreak"));
|
|
4751
|
+
var parsed = [];
|
|
4752
|
+
adBreakNodes.forEach(function(node, index) {
|
|
4753
|
+
var timeOffsetRaw = (node.getAttribute("timeOffset") || "").trim();
|
|
4754
|
+
var startTimeMs = _this.parseVmapTimeOffsetToMs(timeOffsetRaw);
|
|
4755
|
+
if (startTimeMs == null) {
|
|
4756
|
+
return;
|
|
4757
|
+
}
|
|
4758
|
+
var adTagNode = node.querySelector("AdTagURI, vmap\\:AdTagURI");
|
|
4759
|
+
var adTagUrl = ((adTagNode === null || adTagNode === void 0 ? void 0 : adTagNode.textContent) || "").trim();
|
|
4760
|
+
if (!adTagUrl) {
|
|
4761
|
+
return;
|
|
4762
|
+
}
|
|
4763
|
+
var breakId = node.getAttribute("breakId") || "vmap-break-".concat(index, "-").concat(timeOffsetRaw || "unknown");
|
|
4764
|
+
parsed.push({
|
|
4765
|
+
id: breakId,
|
|
4766
|
+
startTimeMs: startTimeMs,
|
|
4767
|
+
vastTagUrl: adTagUrl
|
|
4768
|
+
});
|
|
4769
|
+
});
|
|
4770
|
+
parsed.sort(function(a, b) {
|
|
4771
|
+
var aStart = a.startTimeMs < 0 ? Number.MAX_SAFE_INTEGER : a.startTimeMs;
|
|
4772
|
+
var bStart = b.startTimeMs < 0 ? Number.MAX_SAFE_INTEGER : b.startTimeMs;
|
|
4773
|
+
return aStart - bStart;
|
|
4774
|
+
});
|
|
4775
|
+
return parsed;
|
|
4776
|
+
}
|
|
4777
|
+
},
|
|
4778
|
+
{
|
|
4779
|
+
key: "parseVmapTimeOffsetToMs",
|
|
4780
|
+
value: function parseVmapTimeOffsetToMs(timeOffset) {
|
|
4781
|
+
if (!timeOffset) {
|
|
4782
|
+
return void 0;
|
|
4783
|
+
}
|
|
4784
|
+
var normalized = timeOffset.trim().toLowerCase();
|
|
4785
|
+
if (normalized === "start") {
|
|
4786
|
+
return 0;
|
|
4787
|
+
}
|
|
4788
|
+
if (normalized === "end") {
|
|
4789
|
+
return -1;
|
|
4790
|
+
}
|
|
4791
|
+
var hms = timeOffset.match(/^(\d{1,2}):(\d{2}):(\d{2})(?:\.(\d{1,3}))?$/);
|
|
4792
|
+
if (hms) {
|
|
4793
|
+
var _hms = _sliced_to_array(hms, 5), hh = _hms[1], mm = _hms[2], ss = _hms[3], tmp = _hms[4], ms = tmp === void 0 ? "0" : tmp;
|
|
4794
|
+
var hours = Number(hh);
|
|
4795
|
+
var minutes = Number(mm);
|
|
4796
|
+
var seconds = Number(ss);
|
|
4797
|
+
var millis = Number(ms.padEnd(3, "0").slice(0, 3));
|
|
4798
|
+
return (hours * 3600 + minutes * 60 + seconds) * 1e3 + millis;
|
|
4799
|
+
}
|
|
4800
|
+
var percent = timeOffset.match(/^(\d+(?:\.\d+)?)%$/);
|
|
4801
|
+
if (percent) {
|
|
4802
|
+
var ratio = Number(percent[1]) / 100;
|
|
4803
|
+
var durationSec = this.video.duration;
|
|
4804
|
+
if (Number.isFinite(durationSec) && durationSec > 0) {
|
|
4805
|
+
return Math.floor(durationSec * 1e3 * ratio);
|
|
4806
|
+
}
|
|
4807
|
+
return void 0;
|
|
4808
|
+
}
|
|
4809
|
+
return void 0;
|
|
4810
|
+
}
|
|
4811
|
+
},
|
|
4812
|
+
{
|
|
4813
|
+
key: "getAdBreakKey",
|
|
4814
|
+
value: function getAdBreakKey(adBreak) {
|
|
4815
|
+
if (adBreak.id) {
|
|
4816
|
+
return adBreak.id;
|
|
4817
|
+
}
|
|
4818
|
+
return "".concat(adBreak.startTimeMs, "-").concat(adBreak.vastTagUrl || "");
|
|
4819
|
+
}
|
|
4820
|
+
},
|
|
4821
|
+
{
|
|
4822
|
+
key: "resolveBreakStartMs",
|
|
4823
|
+
value: function resolveBreakStartMs(adBreak) {
|
|
4824
|
+
if (adBreak.startTimeMs >= 0) {
|
|
4825
|
+
return adBreak.startTimeMs;
|
|
4826
|
+
}
|
|
4827
|
+
if (adBreak.startTimeMs === -1) {
|
|
4828
|
+
var durationSec = this.video.duration;
|
|
4829
|
+
if (Number.isFinite(durationSec) && durationSec > 0) {
|
|
4830
|
+
return Math.floor(durationSec * 1e3);
|
|
4831
|
+
}
|
|
4832
|
+
}
|
|
4833
|
+
return void 0;
|
|
4834
|
+
}
|
|
4835
|
+
},
|
|
4657
4836
|
{
|
|
4658
4837
|
key: "getCurrentAdIndex",
|
|
4659
4838
|
value: function getCurrentAdIndex() {
|
|
@@ -4744,10 +4923,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4744
4923
|
var scheduled = this.findCurrentOrNextBreak(this.video.currentTime * 1e3);
|
|
4745
4924
|
var tags = this.selectVastTagsForBreak(scheduled);
|
|
4746
4925
|
var baseVastUrl;
|
|
4747
|
-
if (
|
|
4748
|
-
baseVastUrl = this.apiVastTagUrl;
|
|
4749
|
-
} else if (tags && tags.length > 0 && tags[0]) {
|
|
4926
|
+
if (tags && tags.length > 0 && tags[0]) {
|
|
4750
4927
|
baseVastUrl = tags[0];
|
|
4928
|
+
} else if (this.apiVastTagUrl) {
|
|
4929
|
+
baseVastUrl = this.apiVastTagUrl;
|
|
4751
4930
|
} else {
|
|
4752
4931
|
if (this.config.debugAdTiming) {
|
|
4753
4932
|
console.warn("[StormcloudVideoPlayer] No VAST URL available for prefetch");
|
|
@@ -5197,11 +5376,14 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5197
5376
|
switch(_state.label){
|
|
5198
5377
|
case 0:
|
|
5199
5378
|
scheduled = this.findCurrentOrNextBreak(this.video.currentTime * 1e3);
|
|
5379
|
+
if (scheduled) {
|
|
5380
|
+
this.consumedVmapBreakIds.add(this.getAdBreakKey(scheduled));
|
|
5381
|
+
}
|
|
5200
5382
|
tags = this.selectVastTagsForBreak(scheduled);
|
|
5201
|
-
if (
|
|
5202
|
-
baseVastUrl = this.apiVastTagUrl;
|
|
5203
|
-
} else if (tags && tags.length > 0 && tags[0]) {
|
|
5383
|
+
if (tags && tags.length > 0 && tags[0]) {
|
|
5204
5384
|
baseVastUrl = tags[0];
|
|
5385
|
+
} else if (this.apiVastTagUrl) {
|
|
5386
|
+
baseVastUrl = this.apiVastTagUrl;
|
|
5205
5387
|
} else {
|
|
5206
5388
|
this.clearPendingAdBreak();
|
|
5207
5389
|
return [
|
|
@@ -6080,15 +6262,22 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6080
6262
|
{
|
|
6081
6263
|
key: "findCurrentOrNextBreak",
|
|
6082
6264
|
value: function findCurrentOrNextBreak(nowMs) {
|
|
6083
|
-
var schedule =
|
|
6265
|
+
var schedule = this.vmapBreaks;
|
|
6084
6266
|
var candidate;
|
|
6085
6267
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
6086
6268
|
try {
|
|
6087
6269
|
for(var _iterator = schedule[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
6088
6270
|
var b = _step.value;
|
|
6089
|
-
var _this_config_driftToleranceMs;
|
|
6271
|
+
var _this_config_driftToleranceMs, _this_resolveBreakStartMs;
|
|
6272
|
+
if (this.consumedVmapBreakIds.has(this.getAdBreakKey(b))) {
|
|
6273
|
+
continue;
|
|
6274
|
+
}
|
|
6275
|
+
var breakStartMs = this.resolveBreakStartMs(b);
|
|
6276
|
+
if (breakStartMs == null) {
|
|
6277
|
+
continue;
|
|
6278
|
+
}
|
|
6090
6279
|
var tol = (_this_config_driftToleranceMs = this.config.driftToleranceMs) !== null && _this_config_driftToleranceMs !== void 0 ? _this_config_driftToleranceMs : 1e3;
|
|
6091
|
-
if (
|
|
6280
|
+
if (breakStartMs <= nowMs + tol && (candidate == null || breakStartMs > ((_this_resolveBreakStartMs = this.resolveBreakStartMs(candidate)) !== null && _this_resolveBreakStartMs !== void 0 ? _this_resolveBreakStartMs : 0))) {
|
|
6092
6281
|
candidate = b;
|
|
6093
6282
|
}
|
|
6094
6283
|
}
|
|
@@ -6112,11 +6301,16 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6112
6301
|
{
|
|
6113
6302
|
key: "onTimeUpdate",
|
|
6114
6303
|
value: function onTimeUpdate(currentTimeSec) {
|
|
6115
|
-
|
|
6304
|
+
var _this = this;
|
|
6305
|
+
if (this.ima.isAdPlaying() || this.inAdBreak) return;
|
|
6116
6306
|
var nowMs = currentTimeSec * 1e3;
|
|
6117
6307
|
var breakToPlay = this.findBreakForTime(nowMs);
|
|
6118
6308
|
if (breakToPlay) {
|
|
6119
|
-
this.handleMidAdJoin(breakToPlay, nowMs)
|
|
6309
|
+
void this.handleMidAdJoin(breakToPlay, nowMs).catch(function(error) {
|
|
6310
|
+
if (_this.config.debugAdTiming) {
|
|
6311
|
+
console.warn("[StormcloudVideoPlayer] Mid-roll VMAP join failed gracefully:", error);
|
|
6312
|
+
}
|
|
6313
|
+
});
|
|
6120
6314
|
}
|
|
6121
6315
|
}
|
|
6122
6316
|
},
|
|
@@ -6124,40 +6318,76 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6124
6318
|
key: "handleMidAdJoin",
|
|
6125
6319
|
value: function handleMidAdJoin(adBreak, nowMs) {
|
|
6126
6320
|
return _async_to_generator(function() {
|
|
6127
|
-
var _adBreak_durationMs, durationMs, endMs, remainingMs, tags, first, rest;
|
|
6321
|
+
var _adBreak_durationMs, _this_config_driftToleranceMs, key, breakStartMs, durationMs, endMs, tol, inWindow, remainingMs, tags, first, rest, error;
|
|
6128
6322
|
return _ts_generator(this, function(_state) {
|
|
6129
6323
|
switch(_state.label){
|
|
6130
6324
|
case 0:
|
|
6325
|
+
key = this.getAdBreakKey(adBreak);
|
|
6326
|
+
if (this.consumedVmapBreakIds.has(key)) {
|
|
6327
|
+
return [
|
|
6328
|
+
2
|
|
6329
|
+
];
|
|
6330
|
+
}
|
|
6331
|
+
breakStartMs = this.resolveBreakStartMs(adBreak);
|
|
6332
|
+
if (breakStartMs == null) {
|
|
6333
|
+
return [
|
|
6334
|
+
2
|
|
6335
|
+
];
|
|
6336
|
+
}
|
|
6131
6337
|
durationMs = (_adBreak_durationMs = adBreak.durationMs) !== null && _adBreak_durationMs !== void 0 ? _adBreak_durationMs : 0;
|
|
6132
|
-
endMs =
|
|
6133
|
-
|
|
6338
|
+
endMs = breakStartMs + durationMs;
|
|
6339
|
+
tol = (_this_config_driftToleranceMs = this.config.driftToleranceMs) !== null && _this_config_driftToleranceMs !== void 0 ? _this_config_driftToleranceMs : 1e3;
|
|
6340
|
+
inWindow = durationMs > 0 ? nowMs > breakStartMs && nowMs < endMs : nowMs + tol >= breakStartMs;
|
|
6341
|
+
if (!inWindow) return [
|
|
6134
6342
|
3,
|
|
6135
|
-
|
|
6343
|
+
4
|
|
6136
6344
|
];
|
|
6137
|
-
|
|
6345
|
+
this.consumedVmapBreakIds.add(key);
|
|
6346
|
+
remainingMs = durationMs > 0 ? Math.max(0, endMs - nowMs) : 0;
|
|
6138
6347
|
tags = this.selectVastTagsForBreak(adBreak) || (this.apiVastTagUrl ? [
|
|
6139
6348
|
this.apiVastTagUrl
|
|
6140
6349
|
] : void 0);
|
|
6141
6350
|
if (!(tags && tags.length > 0)) return [
|
|
6142
6351
|
3,
|
|
6143
|
-
|
|
6352
|
+
4
|
|
6144
6353
|
];
|
|
6145
6354
|
first = tags[0];
|
|
6146
6355
|
rest = tags.slice(1);
|
|
6147
6356
|
this.adPodQueue = rest;
|
|
6148
6357
|
this.ima.updateOriginalMutedState(this.video.muted, this.video.volume);
|
|
6358
|
+
_state.label = 1;
|
|
6359
|
+
case 1:
|
|
6360
|
+
_state.trys.push([
|
|
6361
|
+
1,
|
|
6362
|
+
3,
|
|
6363
|
+
,
|
|
6364
|
+
4
|
|
6365
|
+
]);
|
|
6149
6366
|
return [
|
|
6150
6367
|
4,
|
|
6151
6368
|
this.playSingleAd(first)
|
|
6152
6369
|
];
|
|
6153
|
-
case
|
|
6370
|
+
case 2:
|
|
6154
6371
|
_state.sent();
|
|
6155
6372
|
this.inAdBreak = true;
|
|
6156
6373
|
this.expectedAdBreakDurationMs = remainingMs;
|
|
6157
6374
|
this.currentAdBreakStartWallClockMs = Date.now();
|
|
6158
6375
|
this.scheduleAdStopCountdown(remainingMs);
|
|
6159
|
-
|
|
6160
|
-
|
|
6376
|
+
return [
|
|
6377
|
+
3,
|
|
6378
|
+
4
|
|
6379
|
+
];
|
|
6380
|
+
case 3:
|
|
6381
|
+
error = _state.sent();
|
|
6382
|
+
this.adPodQueue = [];
|
|
6383
|
+
if (this.config.debugAdTiming) {
|
|
6384
|
+
console.warn("[StormcloudVideoPlayer] Mid-roll VMAP ad request failed:", error);
|
|
6385
|
+
}
|
|
6386
|
+
return [
|
|
6387
|
+
3,
|
|
6388
|
+
4
|
|
6389
|
+
];
|
|
6390
|
+
case 4:
|
|
6161
6391
|
return [
|
|
6162
6392
|
2
|
|
6163
6393
|
];
|
|
@@ -6863,13 +7093,22 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6863
7093
|
{
|
|
6864
7094
|
key: "findBreakForTime",
|
|
6865
7095
|
value: function findBreakForTime(nowMs) {
|
|
6866
|
-
var
|
|
7096
|
+
var _this_config_driftToleranceMs;
|
|
7097
|
+
var schedule = this.vmapBreaks;
|
|
7098
|
+
var tol = (_this_config_driftToleranceMs = this.config.driftToleranceMs) !== null && _this_config_driftToleranceMs !== void 0 ? _this_config_driftToleranceMs : 1e3;
|
|
6867
7099
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
6868
7100
|
try {
|
|
6869
7101
|
for(var _iterator = schedule[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
6870
7102
|
var b = _step.value;
|
|
6871
|
-
|
|
6872
|
-
|
|
7103
|
+
if (this.consumedVmapBreakIds.has(this.getAdBreakKey(b))) {
|
|
7104
|
+
continue;
|
|
7105
|
+
}
|
|
7106
|
+
var breakStartMs = this.resolveBreakStartMs(b);
|
|
7107
|
+
if (breakStartMs == null) {
|
|
7108
|
+
continue;
|
|
7109
|
+
}
|
|
7110
|
+
var end = breakStartMs + (b.durationMs || 0);
|
|
7111
|
+
if (nowMs >= breakStartMs && (b.durationMs ? nowMs < end : nowMs <= breakStartMs + tol)) {
|
|
6873
7112
|
return b;
|
|
6874
7113
|
}
|
|
6875
7114
|
}
|
|
@@ -7101,13 +7340,14 @@ var CRITICAL_PROPS = [
|
|
|
7101
7340
|
"src",
|
|
7102
7341
|
"allowNativeHls",
|
|
7103
7342
|
"licenseKey",
|
|
7343
|
+
"vmapUrl",
|
|
7104
7344
|
"lowLatencyMode",
|
|
7105
7345
|
"driftToleranceMs",
|
|
7106
7346
|
"vastMode"
|
|
7107
7347
|
];
|
|
7108
7348
|
var CONTROLS_HIDE_DELAY = 3e3;
|
|
7109
7349
|
var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
|
|
7110
|
-
var src = props.src, autoplay = props.autoplay, muted = props.muted, lowLatencyMode = props.lowLatencyMode, allowNativeHls = props.allowNativeHls, driftToleranceMs = props.driftToleranceMs, immediateManifestAds = props.immediateManifestAds, debugAdTiming = props.debugAdTiming, showCustomControls = props.showCustomControls, hideLoadingIndicator = props.hideLoadingIndicator, onVolumeToggle = props.onVolumeToggle, onFullscreenToggle = props.onFullscreenToggle, onControlClick = props.onControlClick, onReady = props.onReady, wrapperClassName = props.wrapperClassName, wrapperStyle = props.wrapperStyle, className = props.className, style = props.style, controls = props.controls, playsInline = props.playsInline, preload = props.preload, poster = props.poster, children = props.children, licenseKey = props.licenseKey, vastMode = props.vastMode, vastTagUrl = props.vastTagUrl, adPlayerType = props.adPlayerType, minSegmentsBeforePlay = props.minSegmentsBeforePlay, restVideoAttrs = _object_without_properties(props, [
|
|
7350
|
+
var src = props.src, autoplay = props.autoplay, muted = props.muted, lowLatencyMode = props.lowLatencyMode, allowNativeHls = props.allowNativeHls, driftToleranceMs = props.driftToleranceMs, immediateManifestAds = props.immediateManifestAds, debugAdTiming = props.debugAdTiming, showCustomControls = props.showCustomControls, hideLoadingIndicator = props.hideLoadingIndicator, onVolumeToggle = props.onVolumeToggle, onFullscreenToggle = props.onFullscreenToggle, onControlClick = props.onControlClick, onReady = props.onReady, wrapperClassName = props.wrapperClassName, wrapperStyle = props.wrapperStyle, className = props.className, style = props.style, controls = props.controls, playsInline = props.playsInline, preload = props.preload, poster = props.poster, children = props.children, licenseKey = props.licenseKey, vastMode = props.vastMode, vastTagUrl = props.vastTagUrl, vmapUrl = props.vmapUrl, adPlayerType = props.adPlayerType, minSegmentsBeforePlay = props.minSegmentsBeforePlay, restVideoAttrs = _object_without_properties(props, [
|
|
7111
7351
|
"src",
|
|
7112
7352
|
"autoplay",
|
|
7113
7353
|
"muted",
|
|
@@ -7134,6 +7374,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
|
|
|
7134
7374
|
"licenseKey",
|
|
7135
7375
|
"vastMode",
|
|
7136
7376
|
"vastTagUrl",
|
|
7377
|
+
"vmapUrl",
|
|
7137
7378
|
"adPlayerType",
|
|
7138
7379
|
"minSegmentsBeforePlay"
|
|
7139
7380
|
]);
|
|
@@ -7273,6 +7514,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
|
|
|
7273
7514
|
src,
|
|
7274
7515
|
allowNativeHls,
|
|
7275
7516
|
licenseKey,
|
|
7517
|
+
vmapUrl,
|
|
7276
7518
|
lowLatencyMode,
|
|
7277
7519
|
driftToleranceMs,
|
|
7278
7520
|
vastMode
|
|
@@ -7315,6 +7557,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
|
|
|
7315
7557
|
if (licenseKey !== void 0) cfg.licenseKey = licenseKey;
|
|
7316
7558
|
if (vastMode !== void 0) cfg.vastMode = vastMode;
|
|
7317
7559
|
if (vastTagUrl !== void 0) cfg.vastTagUrl = vastTagUrl;
|
|
7560
|
+
if (vmapUrl !== void 0) cfg.vmapUrl = vmapUrl;
|
|
7318
7561
|
if (adPlayerType !== void 0) cfg.adPlayerType = adPlayerType;
|
|
7319
7562
|
if (minSegmentsBeforePlay !== void 0) cfg.minSegmentsBeforePlay = minSegmentsBeforePlay;
|
|
7320
7563
|
var player = new StormcloudVideoPlayer(cfg);
|