stormcloud-video-player 0.8.70 → 0.8.72
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/StormcloudPlayer.cjs +42 -5
- package/lib/StormcloudPlayer.cjs.map +1 -1
- package/lib/index.cjs +56 -12
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.ts +6 -1
- package/lib/index.js +56 -12
- package/lib/index.js.map +1 -1
- package/lib/player/EdgePodRequest.cjs +14 -2
- package/lib/player/EdgePodRequest.cjs.map +1 -1
- package/lib/player/EdgePodRequest.d.cts +1 -1
- package/lib/player/HlsEngine.cjs +9 -3
- package/lib/player/HlsEngine.cjs.map +1 -1
- package/lib/player/Scte35Parser.cjs +8 -0
- package/lib/player/Scte35Parser.cjs.map +1 -1
- package/lib/player/Scte35Parser.d.cts +2 -1
- package/lib/player/StormcloudVideoPlayer.cjs +42 -5
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +6 -1
- package/lib/players/HlsPlayer.cjs +42 -5
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +42 -5
- package/lib/players/index.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +56 -12
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -6624,6 +6624,10 @@ function toNumber(val) {
|
|
|
6624
6624
|
var n = typeof val === "string" ? parseFloat(val) : Number(val);
|
|
6625
6625
|
return Number.isNaN(n) ? void 0 : n;
|
|
6626
6626
|
}
|
|
6627
|
+
function getDateRangeDurationSeconds(attrs) {
|
|
6628
|
+
var _toNumber;
|
|
6629
|
+
return (_toNumber = toNumber(attrs["DURATION"])) !== null && _toNumber !== void 0 ? _toNumber : toNumber(attrs["PLANNED-DURATION"]);
|
|
6630
|
+
}
|
|
6627
6631
|
function isManifestBasedMarker(marker) {
|
|
6628
6632
|
var raw = marker.raw;
|
|
6629
6633
|
if (!raw) return false;
|
|
@@ -8989,11 +8993,13 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
8989
8993
|
}
|
|
8990
8994
|
}
|
|
8991
8995
|
if (!tag) continue;
|
|
8996
|
+
if (tag.includes("EXT-X-CUE-OUT-CONT")) continue;
|
|
8992
8997
|
if (tag.includes("EXT-X-CUE-OUT") || tag.includes("EXT-X-DATERANGE")) {
|
|
8993
|
-
var
|
|
8998
|
+
var isDateRange = tag.includes("EXT-X-DATERANGE");
|
|
8999
|
+
var attrs = isDateRange ? parseAttributeList(value) : {};
|
|
8994
9000
|
var hasScteOut = tag.includes("EXT-X-CUE-OUT") || "SCTE35-OUT" in attrs || attrs["SCTE35-OUT"] !== void 0;
|
|
8995
9001
|
if (hasScteOut) {
|
|
8996
|
-
var durationSeconds = parseCueOutDuration(value);
|
|
9002
|
+
var durationSeconds = isDateRange ? getDateRangeDurationSeconds(attrs) : parseCueOutDuration(value);
|
|
8997
9003
|
var marker = _object_spread_props(_object_spread({
|
|
8998
9004
|
type: "start"
|
|
8999
9005
|
}, durationSeconds !== void 0 ? {
|
|
@@ -9167,7 +9173,7 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
9167
9173
|
var hasScteOut = "SCTE35-OUT" in attrs || attrs["SCTE35-OUT"] !== void 0;
|
|
9168
9174
|
var hasScteIn = "SCTE35-IN" in attrs || attrs["SCTE35-IN"] !== void 0;
|
|
9169
9175
|
var klass = String((_attrs_CLASS = attrs["CLASS"]) !== null && _attrs_CLASS !== void 0 ? _attrs_CLASS : "");
|
|
9170
|
-
var duration =
|
|
9176
|
+
var duration = getDateRangeDurationSeconds(attrs);
|
|
9171
9177
|
if (hasScteOut || /com\.apple\.hls\.cue/i.test(klass)) {
|
|
9172
9178
|
var marker2 = _object_spread_props(_object_spread({
|
|
9173
9179
|
type: "start"
|
|
@@ -9434,19 +9440,31 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
9434
9440
|
// src/player/EdgePodRequest.ts
|
|
9435
9441
|
var EDGE_POD_MAX_ADS = 10;
|
|
9436
9442
|
var EDGE_POD_EXCEEDS_BUDGET = "edge_pod_exceeds_budget";
|
|
9443
|
+
var LICENSE_KEY_PLACEHOLDER = /\{licenseKey\}|%7BlicenseKey%7D/gi;
|
|
9437
9444
|
function resolveEdgePodBaseUrl(config) {
|
|
9438
|
-
var _config_edgePodUrl;
|
|
9445
|
+
var _config_edgePodUrl, _config_licenseKey;
|
|
9439
9446
|
if (config.enableEdgePodRequest !== true) return void 0;
|
|
9440
9447
|
var raw = (_config_edgePodUrl = config.edgePodUrl) === null || _config_edgePodUrl === void 0 ? void 0 : _config_edgePodUrl.trim();
|
|
9441
9448
|
if (!raw) {
|
|
9442
9449
|
console.warn("[AdBreak][EDGE] enableEdgePodRequest is true but edgePodUrl is missing; using GAM only");
|
|
9443
9450
|
return void 0;
|
|
9444
9451
|
}
|
|
9452
|
+
var licenseKey = (_config_licenseKey = config.licenseKey) === null || _config_licenseKey === void 0 ? void 0 : _config_licenseKey.trim();
|
|
9453
|
+
if (!licenseKey) {
|
|
9454
|
+
console.warn("[AdBreak][EDGE] enableEdgePodRequest is true but licenseKey is missing; using GAM only");
|
|
9455
|
+
return void 0;
|
|
9456
|
+
}
|
|
9457
|
+
var encodedKey = encodeURIComponent(licenseKey);
|
|
9445
9458
|
try {
|
|
9446
|
-
var
|
|
9459
|
+
var hasPlaceholder = raw.search(LICENSE_KEY_PLACEHOLDER) !== -1;
|
|
9460
|
+
var url = new URL(hasPlaceholder ? raw.replace(LICENSE_KEY_PLACEHOLDER, encodedKey) : raw);
|
|
9447
9461
|
if (url.protocol !== "https:" && url.protocol !== "http:") {
|
|
9448
9462
|
throw new Error("unsupported protocol ".concat(url.protocol));
|
|
9449
9463
|
}
|
|
9464
|
+
if (!hasPlaceholder) {
|
|
9465
|
+
var path = url.pathname.replace(/\/+$/, "");
|
|
9466
|
+
url.pathname = /\/[^/]+\/pod$/.test(path) ? path.replace(/\/[^/]+\/pod$/, "/".concat(encodedKey, "/pod")) : "".concat(path, "/").concat(encodedKey, "/pod");
|
|
9467
|
+
}
|
|
9450
9468
|
return url.toString();
|
|
9451
9469
|
} catch (unused) {
|
|
9452
9470
|
console.warn("[AdBreak][EDGE] edgePodUrl is not a valid http(s) URL; using GAM only");
|
|
@@ -11924,6 +11942,25 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
11924
11942
|
return this.floorLadderEnabled;
|
|
11925
11943
|
}
|
|
11926
11944
|
},
|
|
11945
|
+
{
|
|
11946
|
+
key: "setEdgePodRequest",
|
|
11947
|
+
value: function setEdgePodRequest(update) {
|
|
11948
|
+
if (update.enableEdgePodRequest === this.config.enableEdgePodRequest && update.edgePodUrl === this.config.edgePodUrl) {
|
|
11949
|
+
return;
|
|
11950
|
+
}
|
|
11951
|
+
if (update.enableEdgePodRequest === void 0) delete this.config.enableEdgePodRequest;
|
|
11952
|
+
else this.config.enableEdgePodRequest = update.enableEdgePodRequest;
|
|
11953
|
+
if (update.edgePodUrl === void 0) delete this.config.edgePodUrl;
|
|
11954
|
+
else this.config.edgePodUrl = update.edgePodUrl;
|
|
11955
|
+
this.edgePodBaseUrl = resolveEdgePodBaseUrl(this.config);
|
|
11956
|
+
}
|
|
11957
|
+
},
|
|
11958
|
+
{
|
|
11959
|
+
key: "getEdgePodUrl",
|
|
11960
|
+
value: function getEdgePodUrl() {
|
|
11961
|
+
return this.edgePodBaseUrl;
|
|
11962
|
+
}
|
|
11963
|
+
},
|
|
11927
11964
|
{
|
|
11928
11965
|
key: "warnOnInvalidFloorLadder",
|
|
11929
11966
|
value: function warnOnInvalidFloorLadder(report) {
|
|
@@ -12762,9 +12799,7 @@ var CRITICAL_PROPS = [
|
|
|
12762
12799
|
"ctvAdRequest",
|
|
12763
12800
|
"adFloorMinCents",
|
|
12764
12801
|
"adFloorMaxCents",
|
|
12765
|
-
"adFloorStepCents"
|
|
12766
|
-
"enableEdgePodRequest",
|
|
12767
|
-
"edgePodUrl"
|
|
12802
|
+
"adFloorStepCents"
|
|
12768
12803
|
];
|
|
12769
12804
|
var CONTROLS_HIDE_DELAY = 3e3;
|
|
12770
12805
|
var DEFAULT_PLAYER_ASPECT_RATIO = 16 / 9;
|
|
@@ -12963,9 +12998,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
|
|
|
12963
12998
|
vastMode,
|
|
12964
12999
|
adFloorMinCents,
|
|
12965
13000
|
adFloorMaxCents,
|
|
12966
|
-
adFloorStepCents
|
|
12967
|
-
enableEdgePodRequest,
|
|
12968
|
-
edgePodUrl
|
|
13001
|
+
adFloorStepCents
|
|
12969
13002
|
]);
|
|
12970
13003
|
(0, import_react.useEffect)(function() {
|
|
12971
13004
|
if (typeof window === "undefined") return;
|
|
@@ -13078,6 +13111,17 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
|
|
|
13078
13111
|
}, [
|
|
13079
13112
|
adFloorLadderEnabled
|
|
13080
13113
|
]);
|
|
13114
|
+
(0, import_react.useEffect)(function() {
|
|
13115
|
+
if (!playerRef.current) return;
|
|
13116
|
+
playerRef.current.setEdgePodRequest(_object_spread({}, enableEdgePodRequest !== void 0 ? {
|
|
13117
|
+
enableEdgePodRequest: enableEdgePodRequest
|
|
13118
|
+
} : {}, edgePodUrl !== void 0 ? {
|
|
13119
|
+
edgePodUrl: edgePodUrl
|
|
13120
|
+
} : {}));
|
|
13121
|
+
}, [
|
|
13122
|
+
enableEdgePodRequest,
|
|
13123
|
+
edgePodUrl
|
|
13124
|
+
]);
|
|
13081
13125
|
(0, import_react.useEffect)(function() {
|
|
13082
13126
|
if (!playerRef.current) return;
|
|
13083
13127
|
var checkAdStatus = function checkAdStatus() {
|
|
@@ -14154,7 +14198,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
|
|
|
14154
14198
|
}
|
|
14155
14199
|
}
|
|
14156
14200
|
}
|
|
14157
|
-
if (prevProps.adFloorLadderEnabled !== nextProps.adFloorLadderEnabled) {
|
|
14201
|
+
if (prevProps.adFloorLadderEnabled !== nextProps.adFloorLadderEnabled || prevProps.enableEdgePodRequest !== nextProps.enableEdgePodRequest || prevProps.edgePodUrl !== nextProps.edgePodUrl) {
|
|
14158
14202
|
return false;
|
|
14159
14203
|
}
|
|
14160
14204
|
if (JSON.stringify((_prevProps_adFloorLadder = prevProps.adFloorLadder) !== null && _prevProps_adFloorLadder !== void 0 ? _prevProps_adFloorLadder : null) !== JSON.stringify((_nextProps_adFloorLadder = nextProps.adFloorLadder) !== null && _nextProps_adFloorLadder !== void 0 ? _nextProps_adFloorLadder : null)) {
|