stormcloud-video-player 0.3.62 → 0.3.63
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 +129 -36
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +7 -1
- package/lib/index.d.ts +7 -1
- package/lib/index.js +129 -36
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +122 -35
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +6 -2
- package/lib/players/HlsPlayer.cjs +122 -35
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.d.cts +1 -1
- package/lib/players/index.cjs +122 -35
- 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-BJPNhfLV.d.cts → types-CjI14dPN.d.cts} +1 -0
- package/lib/ui/StormcloudVideoPlayer.cjs +127 -36
- 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.d.cts
CHANGED
|
@@ -35,6 +35,7 @@ interface StormcloudVideoPlayerConfig {
|
|
|
35
35
|
licenseKey?: string;
|
|
36
36
|
adPlayerType?: 'ima' | 'hls';
|
|
37
37
|
vastTagUrl?: string;
|
|
38
|
+
isVmap?: boolean;
|
|
38
39
|
vmapUrl?: string;
|
|
39
40
|
vastMode?: 'adstorm' | 'default';
|
|
40
41
|
minSegmentsBeforePlay?: number;
|
|
@@ -177,6 +178,7 @@ declare class StormcloudVideoPlayer {
|
|
|
177
178
|
private maxPlaceholderDurationMs;
|
|
178
179
|
private isShowingPlaceholder;
|
|
179
180
|
private timeUpdateHandler?;
|
|
181
|
+
private endedHandler?;
|
|
180
182
|
private emptiedHandler?;
|
|
181
183
|
private readonly tsScte35Pids;
|
|
182
184
|
private readonly pmtPids;
|
|
@@ -263,9 +265,11 @@ declare class StormcloudVideoPlayer {
|
|
|
263
265
|
private markerTypeFromSegmentationTypeId;
|
|
264
266
|
private initializeTracking;
|
|
265
267
|
private sendHeartbeatIfNeeded;
|
|
268
|
+
private isVmapEnabled;
|
|
266
269
|
private fetchAdConfiguration;
|
|
267
270
|
private fetchAndParseVmap;
|
|
268
271
|
private parseVmapToBreaks;
|
|
272
|
+
private resolveVmapAdTagUrl;
|
|
269
273
|
private parseVmapTimeOffsetToMs;
|
|
270
274
|
private getAdBreakKey;
|
|
271
275
|
private resolveBreakStartMs;
|
|
@@ -295,7 +299,8 @@ declare class StormcloudVideoPlayer {
|
|
|
295
299
|
private showPlaceholderAndWaitForAds;
|
|
296
300
|
private findCurrentOrNextBreak;
|
|
297
301
|
private onTimeUpdate;
|
|
298
|
-
private
|
|
302
|
+
private onVideoEnded;
|
|
303
|
+
private handleVmapAdBreak;
|
|
299
304
|
private scheduleAdStopCountdown;
|
|
300
305
|
private clearAdStopTimer;
|
|
301
306
|
private ensureAdStoppedByTimer;
|
|
@@ -374,6 +379,7 @@ interface BaseStormcloudPlayerProps {
|
|
|
374
379
|
showCustomControls?: boolean;
|
|
375
380
|
hideLoadingIndicator?: boolean;
|
|
376
381
|
licenseKey?: string;
|
|
382
|
+
isVmap?: boolean;
|
|
377
383
|
vmapUrl?: string;
|
|
378
384
|
adFailsafeTimeoutMs?: number;
|
|
379
385
|
minSegmentsBeforePlay?: number;
|
package/lib/index.d.ts
CHANGED
|
@@ -35,6 +35,7 @@ interface StormcloudVideoPlayerConfig {
|
|
|
35
35
|
licenseKey?: string;
|
|
36
36
|
adPlayerType?: 'ima' | 'hls';
|
|
37
37
|
vastTagUrl?: string;
|
|
38
|
+
isVmap?: boolean;
|
|
38
39
|
vmapUrl?: string;
|
|
39
40
|
vastMode?: 'adstorm' | 'default';
|
|
40
41
|
minSegmentsBeforePlay?: number;
|
|
@@ -177,6 +178,7 @@ declare class StormcloudVideoPlayer {
|
|
|
177
178
|
private maxPlaceholderDurationMs;
|
|
178
179
|
private isShowingPlaceholder;
|
|
179
180
|
private timeUpdateHandler?;
|
|
181
|
+
private endedHandler?;
|
|
180
182
|
private emptiedHandler?;
|
|
181
183
|
private readonly tsScte35Pids;
|
|
182
184
|
private readonly pmtPids;
|
|
@@ -263,9 +265,11 @@ declare class StormcloudVideoPlayer {
|
|
|
263
265
|
private markerTypeFromSegmentationTypeId;
|
|
264
266
|
private initializeTracking;
|
|
265
267
|
private sendHeartbeatIfNeeded;
|
|
268
|
+
private isVmapEnabled;
|
|
266
269
|
private fetchAdConfiguration;
|
|
267
270
|
private fetchAndParseVmap;
|
|
268
271
|
private parseVmapToBreaks;
|
|
272
|
+
private resolveVmapAdTagUrl;
|
|
269
273
|
private parseVmapTimeOffsetToMs;
|
|
270
274
|
private getAdBreakKey;
|
|
271
275
|
private resolveBreakStartMs;
|
|
@@ -295,7 +299,8 @@ declare class StormcloudVideoPlayer {
|
|
|
295
299
|
private showPlaceholderAndWaitForAds;
|
|
296
300
|
private findCurrentOrNextBreak;
|
|
297
301
|
private onTimeUpdate;
|
|
298
|
-
private
|
|
302
|
+
private onVideoEnded;
|
|
303
|
+
private handleVmapAdBreak;
|
|
299
304
|
private scheduleAdStopCountdown;
|
|
300
305
|
private clearAdStopTimer;
|
|
301
306
|
private ensureAdStoppedByTimer;
|
|
@@ -374,6 +379,7 @@ interface BaseStormcloudPlayerProps {
|
|
|
374
379
|
showCustomControls?: boolean;
|
|
375
380
|
hideLoadingIndicator?: boolean;
|
|
376
381
|
licenseKey?: string;
|
|
382
|
+
isVmap?: boolean;
|
|
377
383
|
vmapUrl?: string;
|
|
378
384
|
adFailsafeTimeoutMs?: number;
|
|
379
385
|
minSegmentsBeforePlay?: number;
|
package/lib/index.js
CHANGED
|
@@ -3494,7 +3494,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3494
3494
|
var _level_details, _level_details1;
|
|
3495
3495
|
return (level === null || level === void 0 ? void 0 : (_level_details = level.details) === null || _level_details === void 0 ? void 0 : _level_details.live) === true || (level === null || level === void 0 ? void 0 : (_level_details1 = level.details) === null || _level_details1 === void 0 ? void 0 : _level_details1.type) === "LIVE";
|
|
3496
3496
|
})) !== null && _ref !== void 0 ? _ref : false;
|
|
3497
|
-
if (!this.isLiveStream && this.vmapBreaks.length === 0 && this.apiVastTagUrl) {
|
|
3497
|
+
if (!this.isVmapEnabled() && !this.isLiveStream && this.vmapBreaks.length === 0 && this.apiVastTagUrl) {
|
|
3498
3498
|
prerollKey = "synthetic-vod-preroll";
|
|
3499
3499
|
if (!this.consumedVmapBreakIds.has(prerollKey)) {
|
|
3500
3500
|
this.vmapBreaks = [
|
|
@@ -4077,6 +4077,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4077
4077
|
_this.onTimeUpdate(_this.video.currentTime);
|
|
4078
4078
|
};
|
|
4079
4079
|
this.video.addEventListener("timeupdate", this.timeUpdateHandler);
|
|
4080
|
+
this.endedHandler = function() {
|
|
4081
|
+
_this.onVideoEnded();
|
|
4082
|
+
};
|
|
4083
|
+
this.video.addEventListener("ended", this.endedHandler);
|
|
4080
4084
|
this.emptiedHandler = function() {
|
|
4081
4085
|
if (_this.nativeHlsMode && _this.videoSrcProtection && !_this.ima.isAdPlaying()) {
|
|
4082
4086
|
if (_this.config.debugAdTiming) {
|
|
@@ -5388,6 +5392,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5388
5392
|
}
|
|
5389
5393
|
}
|
|
5390
5394
|
},
|
|
5395
|
+
{
|
|
5396
|
+
key: "isVmapEnabled",
|
|
5397
|
+
value: function isVmapEnabled() {
|
|
5398
|
+
var _this_config_vmapUrl;
|
|
5399
|
+
return !!(this.config.isVmap && ((_this_config_vmapUrl = this.config.vmapUrl) === null || _this_config_vmapUrl === void 0 ? void 0 : _this_config_vmapUrl.trim()));
|
|
5400
|
+
}
|
|
5401
|
+
},
|
|
5391
5402
|
{
|
|
5392
5403
|
key: "fetchAdConfiguration",
|
|
5393
5404
|
value: function fetchAdConfiguration() {
|
|
@@ -5396,7 +5407,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5396
5407
|
return _ts_generator(this, function(_state) {
|
|
5397
5408
|
switch(_state.label){
|
|
5398
5409
|
case 0:
|
|
5399
|
-
if (!this.
|
|
5410
|
+
if (!this.isVmapEnabled()) return [
|
|
5400
5411
|
3,
|
|
5401
5412
|
2
|
|
5402
5413
|
];
|
|
@@ -5406,7 +5417,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5406
5417
|
];
|
|
5407
5418
|
case 1:
|
|
5408
5419
|
_state.sent();
|
|
5409
|
-
|
|
5420
|
+
if (this.config.debugAdTiming) {
|
|
5421
|
+
console.log("[StormcloudVideoPlayer] VMAP mode enabled");
|
|
5422
|
+
}
|
|
5423
|
+
return [
|
|
5424
|
+
2
|
|
5425
|
+
];
|
|
5410
5426
|
case 2:
|
|
5411
5427
|
vastMode = this.config.vastMode || "default";
|
|
5412
5428
|
if (this.config.debugAdTiming) {
|
|
@@ -5574,7 +5590,16 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5574
5590
|
}
|
|
5575
5591
|
return [];
|
|
5576
5592
|
}
|
|
5577
|
-
var
|
|
5593
|
+
var VMAP_NS = "http://www.iab.net/videosuite/vmap";
|
|
5594
|
+
var adBreakNodes = Array.from(doc.getElementsByTagNameNS(VMAP_NS, "AdBreak"));
|
|
5595
|
+
if (adBreakNodes.length === 0) {
|
|
5596
|
+
adBreakNodes = Array.from(doc.querySelectorAll("AdBreak, vmap\\:AdBreak"));
|
|
5597
|
+
}
|
|
5598
|
+
if (adBreakNodes.length === 0) {
|
|
5599
|
+
adBreakNodes = Array.from(doc.getElementsByTagName("*")).filter(function(el) {
|
|
5600
|
+
return el.localName === "AdBreak";
|
|
5601
|
+
});
|
|
5602
|
+
}
|
|
5578
5603
|
var parsed = [];
|
|
5579
5604
|
adBreakNodes.forEach(function(node, index) {
|
|
5580
5605
|
var timeOffsetRaw = (node.getAttribute("timeOffset") || "").trim();
|
|
@@ -5582,8 +5607,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5582
5607
|
if (startTimeMs == null) {
|
|
5583
5608
|
return;
|
|
5584
5609
|
}
|
|
5585
|
-
var adTagNode = node.
|
|
5586
|
-
|
|
5610
|
+
var adTagNode = node.getElementsByTagNameNS(VMAP_NS, "AdTagURI")[0];
|
|
5611
|
+
if (!adTagNode) {
|
|
5612
|
+
var _node_querySelector;
|
|
5613
|
+
adTagNode = (_node_querySelector = node.querySelector("AdTagURI, vmap\\:AdTagURI")) !== null && _node_querySelector !== void 0 ? _node_querySelector : void 0;
|
|
5614
|
+
}
|
|
5615
|
+
if (!adTagNode) {
|
|
5616
|
+
adTagNode = Array.from(node.getElementsByTagName("*")).find(function(el) {
|
|
5617
|
+
return el.localName === "AdTagURI";
|
|
5618
|
+
});
|
|
5619
|
+
}
|
|
5620
|
+
var adTagUrl = _this.resolveVmapAdTagUrl(((adTagNode === null || adTagNode === void 0 ? void 0 : adTagNode.textContent) || "").trim());
|
|
5587
5621
|
if (!adTagUrl) {
|
|
5588
5622
|
return;
|
|
5589
5623
|
}
|
|
@@ -5602,6 +5636,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5602
5636
|
return parsed;
|
|
5603
5637
|
}
|
|
5604
5638
|
},
|
|
5639
|
+
{
|
|
5640
|
+
key: "resolveVmapAdTagUrl",
|
|
5641
|
+
value: function resolveVmapAdTagUrl(url) {
|
|
5642
|
+
if (!url) {
|
|
5643
|
+
return "";
|
|
5644
|
+
}
|
|
5645
|
+
return url.replace(/\[timestamp\]/gi, String(Date.now())).replace(/\$\{GDPR\}/gi, "0").trim();
|
|
5646
|
+
}
|
|
5647
|
+
},
|
|
5605
5648
|
{
|
|
5606
5649
|
key: "parseVmapTimeOffsetToMs",
|
|
5607
5650
|
value: function parseVmapTimeOffsetToMs(timeOffset) {
|
|
@@ -5624,6 +5667,14 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5624
5667
|
var millis = Number(ms.padEnd(3, "0").slice(0, 3));
|
|
5625
5668
|
return (hours * 3600 + minutes * 60 + seconds) * 1e3 + millis;
|
|
5626
5669
|
}
|
|
5670
|
+
var msOnly = timeOffset.match(/^(\d{1,2}):(\d{2})(?:\.(\d{1,3}))?$/);
|
|
5671
|
+
if (msOnly) {
|
|
5672
|
+
var _msOnly = _sliced_to_array(msOnly, 4), mm1 = _msOnly[1], ss1 = _msOnly[2], tmp1 = _msOnly[3], ms1 = tmp1 === void 0 ? "0" : tmp1;
|
|
5673
|
+
var minutes1 = Number(mm1);
|
|
5674
|
+
var seconds1 = Number(ss1);
|
|
5675
|
+
var millis1 = Number(ms1.padEnd(3, "0").slice(0, 3));
|
|
5676
|
+
return (minutes1 * 60 + seconds1) * 1e3 + millis1;
|
|
5677
|
+
}
|
|
5627
5678
|
var percent = timeOffset.match(/^(\d+(?:\.\d+)?)%$/);
|
|
5628
5679
|
if (percent) {
|
|
5629
5680
|
var ratio = Number(percent[1]) / 100;
|
|
@@ -7139,23 +7190,49 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7139
7190
|
key: "onTimeUpdate",
|
|
7140
7191
|
value: function onTimeUpdate(currentTimeSec) {
|
|
7141
7192
|
var _this = this;
|
|
7193
|
+
if (!this.isVmapEnabled() || this.vmapBreaks.length === 0) {
|
|
7194
|
+
return;
|
|
7195
|
+
}
|
|
7142
7196
|
if (this.ima.isAdPlaying() || this.inAdBreak) return;
|
|
7143
7197
|
var nowMs = currentTimeSec * 1e3;
|
|
7144
7198
|
var breakToPlay = this.findBreakForTime(nowMs);
|
|
7145
7199
|
if (breakToPlay) {
|
|
7146
|
-
void this.
|
|
7200
|
+
void this.handleVmapAdBreak(breakToPlay, nowMs).catch(function(error) {
|
|
7201
|
+
if (_this.config.debugAdTiming) {
|
|
7202
|
+
console.warn("[StormcloudVideoPlayer] VMAP ad break failed gracefully:", error);
|
|
7203
|
+
}
|
|
7204
|
+
});
|
|
7205
|
+
}
|
|
7206
|
+
}
|
|
7207
|
+
},
|
|
7208
|
+
{
|
|
7209
|
+
key: "onVideoEnded",
|
|
7210
|
+
value: function onVideoEnded() {
|
|
7211
|
+
var _this = this;
|
|
7212
|
+
if (!this.isVmapEnabled() || this.vmapBreaks.length === 0) {
|
|
7213
|
+
return;
|
|
7214
|
+
}
|
|
7215
|
+
if (this.ima.isAdPlaying() || this.inAdBreak) {
|
|
7216
|
+
return;
|
|
7217
|
+
}
|
|
7218
|
+
var durationMs = Number.isFinite(this.video.duration) ? Math.floor(this.video.duration * 1e3) : 0;
|
|
7219
|
+
var postroll = this.vmapBreaks.find(function(b) {
|
|
7220
|
+
return b.startTimeMs === -1 && !_this.consumedVmapBreakIds.has(_this.getAdBreakKey(b));
|
|
7221
|
+
});
|
|
7222
|
+
if (postroll) {
|
|
7223
|
+
void this.handleVmapAdBreak(postroll, durationMs).catch(function(error) {
|
|
7147
7224
|
if (_this.config.debugAdTiming) {
|
|
7148
|
-
console.warn("[StormcloudVideoPlayer]
|
|
7225
|
+
console.warn("[StormcloudVideoPlayer] VMAP post-roll failed gracefully:", error);
|
|
7149
7226
|
}
|
|
7150
7227
|
});
|
|
7151
7228
|
}
|
|
7152
7229
|
}
|
|
7153
7230
|
},
|
|
7154
7231
|
{
|
|
7155
|
-
key: "
|
|
7156
|
-
value: function
|
|
7232
|
+
key: "handleVmapAdBreak",
|
|
7233
|
+
value: function handleVmapAdBreak(adBreak, nowMs) {
|
|
7157
7234
|
return _async_to_generator(function() {
|
|
7158
|
-
var _adBreak_durationMs,
|
|
7235
|
+
var _adBreak_durationMs, key, breakStartMs, durationMs, endMs, inWindow, tags, first, rest, error;
|
|
7159
7236
|
return _ts_generator(this, function(_state) {
|
|
7160
7237
|
switch(_state.label){
|
|
7161
7238
|
case 0:
|
|
@@ -7173,25 +7250,28 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7173
7250
|
}
|
|
7174
7251
|
durationMs = (_adBreak_durationMs = adBreak.durationMs) !== null && _adBreak_durationMs !== void 0 ? _adBreak_durationMs : 0;
|
|
7175
7252
|
endMs = breakStartMs + durationMs;
|
|
7176
|
-
|
|
7177
|
-
inWindow = durationMs > 0 ? nowMs > breakStartMs && nowMs < endMs : nowMs + tol >= breakStartMs;
|
|
7253
|
+
inWindow = durationMs > 0 ? nowMs >= breakStartMs && nowMs < endMs : nowMs >= breakStartMs;
|
|
7178
7254
|
if (!inWindow) return [
|
|
7179
7255
|
3,
|
|
7180
7256
|
4
|
|
7181
7257
|
];
|
|
7182
7258
|
this.consumedVmapBreakIds.add(key);
|
|
7183
|
-
|
|
7184
|
-
|
|
7185
|
-
|
|
7186
|
-
|
|
7187
|
-
|
|
7188
|
-
|
|
7189
|
-
4
|
|
7190
|
-
];
|
|
7259
|
+
tags = this.selectVastTagsForBreak(adBreak);
|
|
7260
|
+
if (!tags || tags.length === 0) {
|
|
7261
|
+
return [
|
|
7262
|
+
2
|
|
7263
|
+
];
|
|
7264
|
+
}
|
|
7191
7265
|
first = tags[0];
|
|
7192
7266
|
rest = tags.slice(1);
|
|
7193
7267
|
this.adPodQueue = rest;
|
|
7194
7268
|
this.ima.updateOriginalMutedState(this.video.muted, this.video.volume);
|
|
7269
|
+
this.showAds = true;
|
|
7270
|
+
this.inAdBreak = true;
|
|
7271
|
+
this.currentAdBreakStartWallClockMs = Date.now();
|
|
7272
|
+
if (!this.video.paused) {
|
|
7273
|
+
this.video.pause();
|
|
7274
|
+
}
|
|
7195
7275
|
_state.label = 1;
|
|
7196
7276
|
case 1:
|
|
7197
7277
|
_state.trys.push([
|
|
@@ -7206,10 +7286,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7206
7286
|
];
|
|
7207
7287
|
case 2:
|
|
7208
7288
|
_state.sent();
|
|
7209
|
-
this.inAdBreak = true;
|
|
7210
|
-
this.expectedAdBreakDurationMs = remainingMs;
|
|
7211
|
-
this.currentAdBreakStartWallClockMs = Date.now();
|
|
7212
|
-
this.scheduleAdStopCountdown(remainingMs);
|
|
7213
7289
|
return [
|
|
7214
7290
|
3,
|
|
7215
7291
|
4
|
|
@@ -7217,8 +7293,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7217
7293
|
case 3:
|
|
7218
7294
|
error = _state.sent();
|
|
7219
7295
|
this.adPodQueue = [];
|
|
7296
|
+
this.inAdBreak = false;
|
|
7297
|
+
this.showAds = false;
|
|
7220
7298
|
if (this.config.debugAdTiming) {
|
|
7221
|
-
console.warn("[StormcloudVideoPlayer]
|
|
7299
|
+
console.warn("[StormcloudVideoPlayer] VMAP ad request failed:", error);
|
|
7222
7300
|
}
|
|
7223
7301
|
return [
|
|
7224
7302
|
3,
|
|
@@ -7889,16 +7967,18 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7889
7967
|
{
|
|
7890
7968
|
key: "selectVastTagsForBreak",
|
|
7891
7969
|
value: function selectVastTagsForBreak(b) {
|
|
7970
|
+
var _this = this;
|
|
7892
7971
|
if (!b || !b.vastTagUrl) return void 0;
|
|
7893
|
-
|
|
7894
|
-
|
|
7895
|
-
|
|
7972
|
+
var resolvedUrl = this.resolveVmapAdTagUrl(b.vastTagUrl);
|
|
7973
|
+
if (resolvedUrl.includes(",")) {
|
|
7974
|
+
return resolvedUrl.split(",").map(function(s) {
|
|
7975
|
+
return _this.resolveVmapAdTagUrl(s.trim());
|
|
7896
7976
|
}).filter(function(s) {
|
|
7897
7977
|
return s.length > 0;
|
|
7898
7978
|
});
|
|
7899
7979
|
}
|
|
7900
7980
|
return [
|
|
7901
|
-
|
|
7981
|
+
resolvedUrl
|
|
7902
7982
|
];
|
|
7903
7983
|
}
|
|
7904
7984
|
},
|
|
@@ -7930,9 +8010,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7930
8010
|
{
|
|
7931
8011
|
key: "findBreakForTime",
|
|
7932
8012
|
value: function findBreakForTime(nowMs) {
|
|
7933
|
-
var _this_config_driftToleranceMs;
|
|
7934
8013
|
var schedule = this.vmapBreaks;
|
|
7935
|
-
var tol = (_this_config_driftToleranceMs = this.config.driftToleranceMs) !== null && _this_config_driftToleranceMs !== void 0 ? _this_config_driftToleranceMs : 1e3;
|
|
7936
8014
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
7937
8015
|
try {
|
|
7938
8016
|
for(var _iterator = schedule[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
@@ -7944,9 +8022,14 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7944
8022
|
if (breakStartMs == null) {
|
|
7945
8023
|
continue;
|
|
7946
8024
|
}
|
|
7947
|
-
|
|
7948
|
-
|
|
7949
|
-
|
|
8025
|
+
if (b.durationMs) {
|
|
8026
|
+
var end = breakStartMs + b.durationMs;
|
|
8027
|
+
if (nowMs >= breakStartMs && nowMs < end) {
|
|
8028
|
+
return b;
|
|
8029
|
+
}
|
|
8030
|
+
continue;
|
|
8031
|
+
}
|
|
8032
|
+
if (nowMs >= breakStartMs) {
|
|
7950
8033
|
return b;
|
|
7951
8034
|
}
|
|
7952
8035
|
}
|
|
@@ -8154,6 +8237,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8154
8237
|
this.video.removeEventListener("timeupdate", this.timeUpdateHandler);
|
|
8155
8238
|
delete this.timeUpdateHandler;
|
|
8156
8239
|
}
|
|
8240
|
+
if (this.endedHandler) {
|
|
8241
|
+
this.video.removeEventListener("ended", this.endedHandler);
|
|
8242
|
+
delete this.endedHandler;
|
|
8243
|
+
}
|
|
8157
8244
|
if (this.emptiedHandler) {
|
|
8158
8245
|
this.video.removeEventListener("emptied", this.emptiedHandler);
|
|
8159
8246
|
delete this.emptiedHandler;
|
|
@@ -8179,6 +8266,7 @@ var CRITICAL_PROPS = [
|
|
|
8179
8266
|
"allowNativeHls",
|
|
8180
8267
|
"isLiveStream",
|
|
8181
8268
|
"licenseKey",
|
|
8269
|
+
"isVmap",
|
|
8182
8270
|
"vmapUrl",
|
|
8183
8271
|
"lowLatencyMode",
|
|
8184
8272
|
"driftToleranceMs",
|
|
@@ -8187,7 +8275,7 @@ var CRITICAL_PROPS = [
|
|
|
8187
8275
|
var CONTROLS_HIDE_DELAY = 3e3;
|
|
8188
8276
|
var DEFAULT_PLAYER_ASPECT_RATIO = 16 / 9;
|
|
8189
8277
|
var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
8190
|
-
var src = props.src, autoplay = props.autoplay, muted = props.muted, lowLatencyMode = props.lowLatencyMode, allowNativeHls = props.allowNativeHls, isLiveStream = props.isLiveStream, 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, [
|
|
8278
|
+
var src = props.src, autoplay = props.autoplay, muted = props.muted, lowLatencyMode = props.lowLatencyMode, allowNativeHls = props.allowNativeHls, isLiveStream = props.isLiveStream, 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, isVmap = props.isVmap, vmapUrl = props.vmapUrl, adPlayerType = props.adPlayerType, minSegmentsBeforePlay = props.minSegmentsBeforePlay, restVideoAttrs = _object_without_properties(props, [
|
|
8191
8279
|
"src",
|
|
8192
8280
|
"autoplay",
|
|
8193
8281
|
"muted",
|
|
@@ -8215,6 +8303,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
8215
8303
|
"licenseKey",
|
|
8216
8304
|
"vastMode",
|
|
8217
8305
|
"vastTagUrl",
|
|
8306
|
+
"isVmap",
|
|
8218
8307
|
"vmapUrl",
|
|
8219
8308
|
"adPlayerType",
|
|
8220
8309
|
"minSegmentsBeforePlay"
|
|
@@ -8358,6 +8447,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
8358
8447
|
allowNativeHls,
|
|
8359
8448
|
isLiveStream,
|
|
8360
8449
|
licenseKey,
|
|
8450
|
+
isVmap,
|
|
8361
8451
|
vmapUrl,
|
|
8362
8452
|
lowLatencyMode,
|
|
8363
8453
|
driftToleranceMs,
|
|
@@ -8402,6 +8492,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
8402
8492
|
if (licenseKey !== void 0) cfg.licenseKey = licenseKey;
|
|
8403
8493
|
if (vastMode !== void 0) cfg.vastMode = vastMode;
|
|
8404
8494
|
if (vastTagUrl !== void 0) cfg.vastTagUrl = vastTagUrl;
|
|
8495
|
+
if (isVmap !== void 0) cfg.isVmap = isVmap;
|
|
8405
8496
|
if (vmapUrl !== void 0) cfg.vmapUrl = vmapUrl;
|
|
8406
8497
|
if (adPlayerType !== void 0) cfg.adPlayerType = adPlayerType;
|
|
8407
8498
|
if (minSegmentsBeforePlay !== void 0) cfg.minSegmentsBeforePlay = minSegmentsBeforePlay;
|
|
@@ -9565,6 +9656,7 @@ var defaultProps = {
|
|
|
9565
9656
|
showCustomControls: false,
|
|
9566
9657
|
hideLoadingIndicator: false,
|
|
9567
9658
|
licenseKey: "",
|
|
9659
|
+
isVmap: false,
|
|
9568
9660
|
vmapUrl: "",
|
|
9569
9661
|
adFailsafeTimeoutMs: 1e4,
|
|
9570
9662
|
minSegmentsBeforePlay: 2,
|
|
@@ -10512,6 +10604,7 @@ var SUPPORTED_PROPS = [
|
|
|
10512
10604
|
"debugAdTiming",
|
|
10513
10605
|
"showCustomControls",
|
|
10514
10606
|
"licenseKey",
|
|
10607
|
+
"isVmap",
|
|
10515
10608
|
"vmapUrl",
|
|
10516
10609
|
"adFailsafeTimeoutMs",
|
|
10517
10610
|
"minSegmentsBeforePlay",
|