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/index.cjs
CHANGED
|
@@ -3427,6 +3427,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3427
3427
|
this.inAdBreak = false;
|
|
3428
3428
|
this.ptsDriftEmaMs = 0;
|
|
3429
3429
|
this.adPodQueue = [];
|
|
3430
|
+
this.vmapBreaks = [];
|
|
3431
|
+
this.consumedVmapBreakIds = /* @__PURE__ */ new Set();
|
|
3430
3432
|
this.lastHeartbeatTime = 0;
|
|
3431
3433
|
this.currentAdIndex = 0;
|
|
3432
3434
|
this.totalAdsInBreak = 0;
|
|
@@ -4755,6 +4757,18 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4755
4757
|
return _ts_generator(this, function(_state) {
|
|
4756
4758
|
switch(_state.label){
|
|
4757
4759
|
case 0:
|
|
4760
|
+
if (!this.config.vmapUrl) return [
|
|
4761
|
+
3,
|
|
4762
|
+
2
|
|
4763
|
+
];
|
|
4764
|
+
return [
|
|
4765
|
+
4,
|
|
4766
|
+
this.fetchAndParseVmap(this.config.vmapUrl)
|
|
4767
|
+
];
|
|
4768
|
+
case 1:
|
|
4769
|
+
_state.sent();
|
|
4770
|
+
_state.label = 2;
|
|
4771
|
+
case 2:
|
|
4758
4772
|
vastMode = this.config.vastMode || "default";
|
|
4759
4773
|
if (this.config.debugAdTiming) {
|
|
4760
4774
|
console.log("[StormcloudVideoPlayer] VAST mode:", vastMode);
|
|
@@ -4800,7 +4814,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4800
4814
|
headers: headers
|
|
4801
4815
|
})
|
|
4802
4816
|
];
|
|
4803
|
-
case
|
|
4817
|
+
case 3:
|
|
4804
4818
|
response = _state.sent();
|
|
4805
4819
|
if (!response.ok) {
|
|
4806
4820
|
if (this.config.debugAdTiming) {
|
|
@@ -4814,7 +4828,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4814
4828
|
4,
|
|
4815
4829
|
response.json()
|
|
4816
4830
|
];
|
|
4817
|
-
case
|
|
4831
|
+
case 4:
|
|
4818
4832
|
data = _state.sent();
|
|
4819
4833
|
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;
|
|
4820
4834
|
if (imaPayload) {
|
|
@@ -4842,6 +4856,171 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4842
4856
|
}).call(this);
|
|
4843
4857
|
}
|
|
4844
4858
|
},
|
|
4859
|
+
{
|
|
4860
|
+
key: "fetchAndParseVmap",
|
|
4861
|
+
value: function fetchAndParseVmap(vmapUrl) {
|
|
4862
|
+
return _async_to_generator(function() {
|
|
4863
|
+
var response, vmapXml, error;
|
|
4864
|
+
return _ts_generator(this, function(_state) {
|
|
4865
|
+
switch(_state.label){
|
|
4866
|
+
case 0:
|
|
4867
|
+
if (!vmapUrl.trim()) {
|
|
4868
|
+
return [
|
|
4869
|
+
2
|
|
4870
|
+
];
|
|
4871
|
+
}
|
|
4872
|
+
_state.label = 1;
|
|
4873
|
+
case 1:
|
|
4874
|
+
_state.trys.push([
|
|
4875
|
+
1,
|
|
4876
|
+
4,
|
|
4877
|
+
,
|
|
4878
|
+
5
|
|
4879
|
+
]);
|
|
4880
|
+
return [
|
|
4881
|
+
4,
|
|
4882
|
+
fetch(vmapUrl)
|
|
4883
|
+
];
|
|
4884
|
+
case 2:
|
|
4885
|
+
response = _state.sent();
|
|
4886
|
+
if (!response.ok) {
|
|
4887
|
+
throw new Error("Failed to fetch VMAP (".concat(response.status, ")"));
|
|
4888
|
+
}
|
|
4889
|
+
return [
|
|
4890
|
+
4,
|
|
4891
|
+
response.text()
|
|
4892
|
+
];
|
|
4893
|
+
case 3:
|
|
4894
|
+
vmapXml = _state.sent();
|
|
4895
|
+
this.vmapBreaks = this.parseVmapToBreaks(vmapXml);
|
|
4896
|
+
this.consumedVmapBreakIds.clear();
|
|
4897
|
+
if (this.config.debugAdTiming) {
|
|
4898
|
+
console.log("[StormcloudVideoPlayer] Loaded ".concat(this.vmapBreaks.length, " VMAP ad break(s) from:"), vmapUrl);
|
|
4899
|
+
}
|
|
4900
|
+
return [
|
|
4901
|
+
3,
|
|
4902
|
+
5
|
|
4903
|
+
];
|
|
4904
|
+
case 4:
|
|
4905
|
+
error = _state.sent();
|
|
4906
|
+
this.vmapBreaks = [];
|
|
4907
|
+
this.consumedVmapBreakIds.clear();
|
|
4908
|
+
if (this.config.debugAdTiming) {
|
|
4909
|
+
console.warn("[StormcloudVideoPlayer] Failed to load VMAP:", error);
|
|
4910
|
+
}
|
|
4911
|
+
return [
|
|
4912
|
+
3,
|
|
4913
|
+
5
|
|
4914
|
+
];
|
|
4915
|
+
case 5:
|
|
4916
|
+
return [
|
|
4917
|
+
2
|
|
4918
|
+
];
|
|
4919
|
+
}
|
|
4920
|
+
});
|
|
4921
|
+
}).call(this);
|
|
4922
|
+
}
|
|
4923
|
+
},
|
|
4924
|
+
{
|
|
4925
|
+
key: "parseVmapToBreaks",
|
|
4926
|
+
value: function parseVmapToBreaks(vmapXml) {
|
|
4927
|
+
var _this = this;
|
|
4928
|
+
if (typeof DOMParser === "undefined") {
|
|
4929
|
+
return [];
|
|
4930
|
+
}
|
|
4931
|
+
var doc = new DOMParser().parseFromString(vmapXml, "application/xml");
|
|
4932
|
+
if (doc.querySelector("parsererror")) {
|
|
4933
|
+
if (this.config.debugAdTiming) {
|
|
4934
|
+
console.warn("[StormcloudVideoPlayer] Invalid VMAP XML received");
|
|
4935
|
+
}
|
|
4936
|
+
return [];
|
|
4937
|
+
}
|
|
4938
|
+
var adBreakNodes = Array.from(doc.querySelectorAll("AdBreak, vmap\\:AdBreak"));
|
|
4939
|
+
var parsed = [];
|
|
4940
|
+
adBreakNodes.forEach(function(node, index) {
|
|
4941
|
+
var timeOffsetRaw = (node.getAttribute("timeOffset") || "").trim();
|
|
4942
|
+
var startTimeMs = _this.parseVmapTimeOffsetToMs(timeOffsetRaw);
|
|
4943
|
+
if (startTimeMs == null) {
|
|
4944
|
+
return;
|
|
4945
|
+
}
|
|
4946
|
+
var adTagNode = node.querySelector("AdTagURI, vmap\\:AdTagURI");
|
|
4947
|
+
var adTagUrl = ((adTagNode === null || adTagNode === void 0 ? void 0 : adTagNode.textContent) || "").trim();
|
|
4948
|
+
if (!adTagUrl) {
|
|
4949
|
+
return;
|
|
4950
|
+
}
|
|
4951
|
+
var breakId = node.getAttribute("breakId") || "vmap-break-".concat(index, "-").concat(timeOffsetRaw || "unknown");
|
|
4952
|
+
parsed.push({
|
|
4953
|
+
id: breakId,
|
|
4954
|
+
startTimeMs: startTimeMs,
|
|
4955
|
+
vastTagUrl: adTagUrl
|
|
4956
|
+
});
|
|
4957
|
+
});
|
|
4958
|
+
parsed.sort(function(a, b) {
|
|
4959
|
+
var aStart = a.startTimeMs < 0 ? Number.MAX_SAFE_INTEGER : a.startTimeMs;
|
|
4960
|
+
var bStart = b.startTimeMs < 0 ? Number.MAX_SAFE_INTEGER : b.startTimeMs;
|
|
4961
|
+
return aStart - bStart;
|
|
4962
|
+
});
|
|
4963
|
+
return parsed;
|
|
4964
|
+
}
|
|
4965
|
+
},
|
|
4966
|
+
{
|
|
4967
|
+
key: "parseVmapTimeOffsetToMs",
|
|
4968
|
+
value: function parseVmapTimeOffsetToMs(timeOffset) {
|
|
4969
|
+
if (!timeOffset) {
|
|
4970
|
+
return void 0;
|
|
4971
|
+
}
|
|
4972
|
+
var normalized = timeOffset.trim().toLowerCase();
|
|
4973
|
+
if (normalized === "start") {
|
|
4974
|
+
return 0;
|
|
4975
|
+
}
|
|
4976
|
+
if (normalized === "end") {
|
|
4977
|
+
return -1;
|
|
4978
|
+
}
|
|
4979
|
+
var hms = timeOffset.match(/^(\d{1,2}):(\d{2}):(\d{2})(?:\.(\d{1,3}))?$/);
|
|
4980
|
+
if (hms) {
|
|
4981
|
+
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;
|
|
4982
|
+
var hours = Number(hh);
|
|
4983
|
+
var minutes = Number(mm);
|
|
4984
|
+
var seconds = Number(ss);
|
|
4985
|
+
var millis = Number(ms.padEnd(3, "0").slice(0, 3));
|
|
4986
|
+
return (hours * 3600 + minutes * 60 + seconds) * 1e3 + millis;
|
|
4987
|
+
}
|
|
4988
|
+
var percent = timeOffset.match(/^(\d+(?:\.\d+)?)%$/);
|
|
4989
|
+
if (percent) {
|
|
4990
|
+
var ratio = Number(percent[1]) / 100;
|
|
4991
|
+
var durationSec = this.video.duration;
|
|
4992
|
+
if (Number.isFinite(durationSec) && durationSec > 0) {
|
|
4993
|
+
return Math.floor(durationSec * 1e3 * ratio);
|
|
4994
|
+
}
|
|
4995
|
+
return void 0;
|
|
4996
|
+
}
|
|
4997
|
+
return void 0;
|
|
4998
|
+
}
|
|
4999
|
+
},
|
|
5000
|
+
{
|
|
5001
|
+
key: "getAdBreakKey",
|
|
5002
|
+
value: function getAdBreakKey(adBreak) {
|
|
5003
|
+
if (adBreak.id) {
|
|
5004
|
+
return adBreak.id;
|
|
5005
|
+
}
|
|
5006
|
+
return "".concat(adBreak.startTimeMs, "-").concat(adBreak.vastTagUrl || "");
|
|
5007
|
+
}
|
|
5008
|
+
},
|
|
5009
|
+
{
|
|
5010
|
+
key: "resolveBreakStartMs",
|
|
5011
|
+
value: function resolveBreakStartMs(adBreak) {
|
|
5012
|
+
if (adBreak.startTimeMs >= 0) {
|
|
5013
|
+
return adBreak.startTimeMs;
|
|
5014
|
+
}
|
|
5015
|
+
if (adBreak.startTimeMs === -1) {
|
|
5016
|
+
var durationSec = this.video.duration;
|
|
5017
|
+
if (Number.isFinite(durationSec) && durationSec > 0) {
|
|
5018
|
+
return Math.floor(durationSec * 1e3);
|
|
5019
|
+
}
|
|
5020
|
+
}
|
|
5021
|
+
return void 0;
|
|
5022
|
+
}
|
|
5023
|
+
},
|
|
4845
5024
|
{
|
|
4846
5025
|
key: "getCurrentAdIndex",
|
|
4847
5026
|
value: function getCurrentAdIndex() {
|
|
@@ -4932,10 +5111,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4932
5111
|
var scheduled = this.findCurrentOrNextBreak(this.video.currentTime * 1e3);
|
|
4933
5112
|
var tags = this.selectVastTagsForBreak(scheduled);
|
|
4934
5113
|
var baseVastUrl;
|
|
4935
|
-
if (
|
|
4936
|
-
baseVastUrl = this.apiVastTagUrl;
|
|
4937
|
-
} else if (tags && tags.length > 0 && tags[0]) {
|
|
5114
|
+
if (tags && tags.length > 0 && tags[0]) {
|
|
4938
5115
|
baseVastUrl = tags[0];
|
|
5116
|
+
} else if (this.apiVastTagUrl) {
|
|
5117
|
+
baseVastUrl = this.apiVastTagUrl;
|
|
4939
5118
|
} else {
|
|
4940
5119
|
if (this.config.debugAdTiming) {
|
|
4941
5120
|
console.warn("[StormcloudVideoPlayer] No VAST URL available for prefetch");
|
|
@@ -5385,11 +5564,14 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5385
5564
|
switch(_state.label){
|
|
5386
5565
|
case 0:
|
|
5387
5566
|
scheduled = this.findCurrentOrNextBreak(this.video.currentTime * 1e3);
|
|
5567
|
+
if (scheduled) {
|
|
5568
|
+
this.consumedVmapBreakIds.add(this.getAdBreakKey(scheduled));
|
|
5569
|
+
}
|
|
5388
5570
|
tags = this.selectVastTagsForBreak(scheduled);
|
|
5389
|
-
if (
|
|
5390
|
-
baseVastUrl = this.apiVastTagUrl;
|
|
5391
|
-
} else if (tags && tags.length > 0 && tags[0]) {
|
|
5571
|
+
if (tags && tags.length > 0 && tags[0]) {
|
|
5392
5572
|
baseVastUrl = tags[0];
|
|
5573
|
+
} else if (this.apiVastTagUrl) {
|
|
5574
|
+
baseVastUrl = this.apiVastTagUrl;
|
|
5393
5575
|
} else {
|
|
5394
5576
|
this.clearPendingAdBreak();
|
|
5395
5577
|
return [
|
|
@@ -6268,15 +6450,22 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6268
6450
|
{
|
|
6269
6451
|
key: "findCurrentOrNextBreak",
|
|
6270
6452
|
value: function findCurrentOrNextBreak(nowMs) {
|
|
6271
|
-
var schedule =
|
|
6453
|
+
var schedule = this.vmapBreaks;
|
|
6272
6454
|
var candidate;
|
|
6273
6455
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
6274
6456
|
try {
|
|
6275
6457
|
for(var _iterator = schedule[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
6276
6458
|
var b = _step.value;
|
|
6277
|
-
var _this_config_driftToleranceMs;
|
|
6459
|
+
var _this_config_driftToleranceMs, _this_resolveBreakStartMs;
|
|
6460
|
+
if (this.consumedVmapBreakIds.has(this.getAdBreakKey(b))) {
|
|
6461
|
+
continue;
|
|
6462
|
+
}
|
|
6463
|
+
var breakStartMs = this.resolveBreakStartMs(b);
|
|
6464
|
+
if (breakStartMs == null) {
|
|
6465
|
+
continue;
|
|
6466
|
+
}
|
|
6278
6467
|
var tol = (_this_config_driftToleranceMs = this.config.driftToleranceMs) !== null && _this_config_driftToleranceMs !== void 0 ? _this_config_driftToleranceMs : 1e3;
|
|
6279
|
-
if (
|
|
6468
|
+
if (breakStartMs <= nowMs + tol && (candidate == null || breakStartMs > ((_this_resolveBreakStartMs = this.resolveBreakStartMs(candidate)) !== null && _this_resolveBreakStartMs !== void 0 ? _this_resolveBreakStartMs : 0))) {
|
|
6280
6469
|
candidate = b;
|
|
6281
6470
|
}
|
|
6282
6471
|
}
|
|
@@ -6300,11 +6489,16 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6300
6489
|
{
|
|
6301
6490
|
key: "onTimeUpdate",
|
|
6302
6491
|
value: function onTimeUpdate(currentTimeSec) {
|
|
6303
|
-
|
|
6492
|
+
var _this = this;
|
|
6493
|
+
if (this.ima.isAdPlaying() || this.inAdBreak) return;
|
|
6304
6494
|
var nowMs = currentTimeSec * 1e3;
|
|
6305
6495
|
var breakToPlay = this.findBreakForTime(nowMs);
|
|
6306
6496
|
if (breakToPlay) {
|
|
6307
|
-
this.handleMidAdJoin(breakToPlay, nowMs)
|
|
6497
|
+
void this.handleMidAdJoin(breakToPlay, nowMs).catch(function(error) {
|
|
6498
|
+
if (_this.config.debugAdTiming) {
|
|
6499
|
+
console.warn("[StormcloudVideoPlayer] Mid-roll VMAP join failed gracefully:", error);
|
|
6500
|
+
}
|
|
6501
|
+
});
|
|
6308
6502
|
}
|
|
6309
6503
|
}
|
|
6310
6504
|
},
|
|
@@ -6312,40 +6506,76 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6312
6506
|
key: "handleMidAdJoin",
|
|
6313
6507
|
value: function handleMidAdJoin(adBreak, nowMs) {
|
|
6314
6508
|
return _async_to_generator(function() {
|
|
6315
|
-
var _adBreak_durationMs, durationMs, endMs, remainingMs, tags, first, rest;
|
|
6509
|
+
var _adBreak_durationMs, _this_config_driftToleranceMs, key, breakStartMs, durationMs, endMs, tol, inWindow, remainingMs, tags, first, rest, error;
|
|
6316
6510
|
return _ts_generator(this, function(_state) {
|
|
6317
6511
|
switch(_state.label){
|
|
6318
6512
|
case 0:
|
|
6513
|
+
key = this.getAdBreakKey(adBreak);
|
|
6514
|
+
if (this.consumedVmapBreakIds.has(key)) {
|
|
6515
|
+
return [
|
|
6516
|
+
2
|
|
6517
|
+
];
|
|
6518
|
+
}
|
|
6519
|
+
breakStartMs = this.resolveBreakStartMs(adBreak);
|
|
6520
|
+
if (breakStartMs == null) {
|
|
6521
|
+
return [
|
|
6522
|
+
2
|
|
6523
|
+
];
|
|
6524
|
+
}
|
|
6319
6525
|
durationMs = (_adBreak_durationMs = adBreak.durationMs) !== null && _adBreak_durationMs !== void 0 ? _adBreak_durationMs : 0;
|
|
6320
|
-
endMs =
|
|
6321
|
-
|
|
6526
|
+
endMs = breakStartMs + durationMs;
|
|
6527
|
+
tol = (_this_config_driftToleranceMs = this.config.driftToleranceMs) !== null && _this_config_driftToleranceMs !== void 0 ? _this_config_driftToleranceMs : 1e3;
|
|
6528
|
+
inWindow = durationMs > 0 ? nowMs > breakStartMs && nowMs < endMs : nowMs + tol >= breakStartMs;
|
|
6529
|
+
if (!inWindow) return [
|
|
6322
6530
|
3,
|
|
6323
|
-
|
|
6531
|
+
4
|
|
6324
6532
|
];
|
|
6325
|
-
|
|
6533
|
+
this.consumedVmapBreakIds.add(key);
|
|
6534
|
+
remainingMs = durationMs > 0 ? Math.max(0, endMs - nowMs) : 0;
|
|
6326
6535
|
tags = this.selectVastTagsForBreak(adBreak) || (this.apiVastTagUrl ? [
|
|
6327
6536
|
this.apiVastTagUrl
|
|
6328
6537
|
] : void 0);
|
|
6329
6538
|
if (!(tags && tags.length > 0)) return [
|
|
6330
6539
|
3,
|
|
6331
|
-
|
|
6540
|
+
4
|
|
6332
6541
|
];
|
|
6333
6542
|
first = tags[0];
|
|
6334
6543
|
rest = tags.slice(1);
|
|
6335
6544
|
this.adPodQueue = rest;
|
|
6336
6545
|
this.ima.updateOriginalMutedState(this.video.muted, this.video.volume);
|
|
6546
|
+
_state.label = 1;
|
|
6547
|
+
case 1:
|
|
6548
|
+
_state.trys.push([
|
|
6549
|
+
1,
|
|
6550
|
+
3,
|
|
6551
|
+
,
|
|
6552
|
+
4
|
|
6553
|
+
]);
|
|
6337
6554
|
return [
|
|
6338
6555
|
4,
|
|
6339
6556
|
this.playSingleAd(first)
|
|
6340
6557
|
];
|
|
6341
|
-
case
|
|
6558
|
+
case 2:
|
|
6342
6559
|
_state.sent();
|
|
6343
6560
|
this.inAdBreak = true;
|
|
6344
6561
|
this.expectedAdBreakDurationMs = remainingMs;
|
|
6345
6562
|
this.currentAdBreakStartWallClockMs = Date.now();
|
|
6346
6563
|
this.scheduleAdStopCountdown(remainingMs);
|
|
6347
|
-
|
|
6348
|
-
|
|
6564
|
+
return [
|
|
6565
|
+
3,
|
|
6566
|
+
4
|
|
6567
|
+
];
|
|
6568
|
+
case 3:
|
|
6569
|
+
error = _state.sent();
|
|
6570
|
+
this.adPodQueue = [];
|
|
6571
|
+
if (this.config.debugAdTiming) {
|
|
6572
|
+
console.warn("[StormcloudVideoPlayer] Mid-roll VMAP ad request failed:", error);
|
|
6573
|
+
}
|
|
6574
|
+
return [
|
|
6575
|
+
3,
|
|
6576
|
+
4
|
|
6577
|
+
];
|
|
6578
|
+
case 4:
|
|
6349
6579
|
return [
|
|
6350
6580
|
2
|
|
6351
6581
|
];
|
|
@@ -7051,13 +7281,22 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7051
7281
|
{
|
|
7052
7282
|
key: "findBreakForTime",
|
|
7053
7283
|
value: function findBreakForTime(nowMs) {
|
|
7054
|
-
var
|
|
7284
|
+
var _this_config_driftToleranceMs;
|
|
7285
|
+
var schedule = this.vmapBreaks;
|
|
7286
|
+
var tol = (_this_config_driftToleranceMs = this.config.driftToleranceMs) !== null && _this_config_driftToleranceMs !== void 0 ? _this_config_driftToleranceMs : 1e3;
|
|
7055
7287
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
7056
7288
|
try {
|
|
7057
7289
|
for(var _iterator = schedule[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
7058
7290
|
var b = _step.value;
|
|
7059
|
-
|
|
7060
|
-
|
|
7291
|
+
if (this.consumedVmapBreakIds.has(this.getAdBreakKey(b))) {
|
|
7292
|
+
continue;
|
|
7293
|
+
}
|
|
7294
|
+
var breakStartMs = this.resolveBreakStartMs(b);
|
|
7295
|
+
if (breakStartMs == null) {
|
|
7296
|
+
continue;
|
|
7297
|
+
}
|
|
7298
|
+
var end = breakStartMs + (b.durationMs || 0);
|
|
7299
|
+
if (nowMs >= breakStartMs && (b.durationMs ? nowMs < end : nowMs <= breakStartMs + tol)) {
|
|
7061
7300
|
return b;
|
|
7062
7301
|
}
|
|
7063
7302
|
}
|
|
@@ -7289,13 +7528,14 @@ var CRITICAL_PROPS = [
|
|
|
7289
7528
|
"src",
|
|
7290
7529
|
"allowNativeHls",
|
|
7291
7530
|
"licenseKey",
|
|
7531
|
+
"vmapUrl",
|
|
7292
7532
|
"lowLatencyMode",
|
|
7293
7533
|
"driftToleranceMs",
|
|
7294
7534
|
"vastMode"
|
|
7295
7535
|
];
|
|
7296
7536
|
var CONTROLS_HIDE_DELAY = 3e3;
|
|
7297
7537
|
var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
|
|
7298
|
-
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, [
|
|
7538
|
+
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, [
|
|
7299
7539
|
"src",
|
|
7300
7540
|
"autoplay",
|
|
7301
7541
|
"muted",
|
|
@@ -7322,6 +7562,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
|
|
|
7322
7562
|
"licenseKey",
|
|
7323
7563
|
"vastMode",
|
|
7324
7564
|
"vastTagUrl",
|
|
7565
|
+
"vmapUrl",
|
|
7325
7566
|
"adPlayerType",
|
|
7326
7567
|
"minSegmentsBeforePlay"
|
|
7327
7568
|
]);
|
|
@@ -7461,6 +7702,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
|
|
|
7461
7702
|
src,
|
|
7462
7703
|
allowNativeHls,
|
|
7463
7704
|
licenseKey,
|
|
7705
|
+
vmapUrl,
|
|
7464
7706
|
lowLatencyMode,
|
|
7465
7707
|
driftToleranceMs,
|
|
7466
7708
|
vastMode
|
|
@@ -7503,6 +7745,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
|
|
|
7503
7745
|
if (licenseKey !== void 0) cfg.licenseKey = licenseKey;
|
|
7504
7746
|
if (vastMode !== void 0) cfg.vastMode = vastMode;
|
|
7505
7747
|
if (vastTagUrl !== void 0) cfg.vastTagUrl = vastTagUrl;
|
|
7748
|
+
if (vmapUrl !== void 0) cfg.vmapUrl = vmapUrl;
|
|
7506
7749
|
if (adPlayerType !== void 0) cfg.adPlayerType = adPlayerType;
|
|
7507
7750
|
if (minSegmentsBeforePlay !== void 0) cfg.minSegmentsBeforePlay = minSegmentsBeforePlay;
|
|
7508
7751
|
var player = new StormcloudVideoPlayer(cfg);
|
|
@@ -8542,6 +8785,7 @@ var defaultProps = {
|
|
|
8542
8785
|
showCustomControls: false,
|
|
8543
8786
|
hideLoadingIndicator: false,
|
|
8544
8787
|
licenseKey: "",
|
|
8788
|
+
vmapUrl: "",
|
|
8545
8789
|
adFailsafeTimeoutMs: 1e4,
|
|
8546
8790
|
minSegmentsBeforePlay: 2,
|
|
8547
8791
|
onStart: noop,
|
|
@@ -9485,6 +9729,7 @@ var SUPPORTED_PROPS = [
|
|
|
9485
9729
|
"debugAdTiming",
|
|
9486
9730
|
"showCustomControls",
|
|
9487
9731
|
"licenseKey",
|
|
9732
|
+
"vmapUrl",
|
|
9488
9733
|
"adFailsafeTimeoutMs",
|
|
9489
9734
|
"minSegmentsBeforePlay",
|
|
9490
9735
|
"onReady",
|