stormcloud-video-player 0.5.3 → 0.5.5
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 +526 -379
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +356 -221
- package/lib/index.d.ts +356 -221
- package/lib/index.js +485 -338
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +255 -117
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +8 -1
- package/lib/players/FilePlayer.cjs +99 -116
- package/lib/players/FilePlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.cjs +307 -169
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +386 -248
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.cjs +21 -11
- package/lib/sdk/hlsAdPlayer.cjs.map +1 -1
- package/lib/sdk/ima.cjs +28 -20
- package/lib/sdk/ima.cjs.map +1 -1
- package/lib/sdk/prebid.cjs +17 -9
- package/lib/sdk/prebid.cjs.map +1 -1
- package/lib/sdk/prebidController.cjs +24 -12
- package/lib/sdk/prebidController.cjs.map +1 -1
- package/lib/sdk/vastParser.cjs +19 -11
- package/lib/sdk/vastParser.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +346 -199
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/utils/browserCompat.cjs +11 -11
- package/lib/utils/browserCompat.cjs.map +1 -1
- package/lib/utils/polyfills.cjs +13 -13
- package/lib/utils/polyfills.cjs.map +1 -1
- package/lib/utils/tracking.cjs +19 -11
- package/lib/utils/tracking.cjs.map +1 -1
- package/package.json +1 -1
package/lib/sdk/prebid.cjs
CHANGED
|
@@ -66,9 +66,17 @@ function _ts_generator(thisArg, body) {
|
|
|
66
66
|
},
|
|
67
67
|
trys: [],
|
|
68
68
|
ops: []
|
|
69
|
-
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
70
|
-
return
|
|
71
|
-
|
|
69
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
|
|
70
|
+
return d(g, "next", {
|
|
71
|
+
value: verb(0)
|
|
72
|
+
}), d(g, "throw", {
|
|
73
|
+
value: verb(1)
|
|
74
|
+
}), d(g, "return", {
|
|
75
|
+
value: verb(2)
|
|
76
|
+
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
77
|
+
value: function() {
|
|
78
|
+
return this;
|
|
79
|
+
}
|
|
72
80
|
}), g;
|
|
73
81
|
function verb(n) {
|
|
74
82
|
return function(v) {
|
|
@@ -152,20 +160,20 @@ var __defProp = Object.defineProperty;
|
|
|
152
160
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
153
161
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
154
162
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
155
|
-
var __export = function(target, all) {
|
|
163
|
+
var __export = function __export(target, all) {
|
|
156
164
|
for(var name in all)__defProp(target, name, {
|
|
157
165
|
get: all[name],
|
|
158
166
|
enumerable: true
|
|
159
167
|
});
|
|
160
168
|
};
|
|
161
|
-
var __copyProps = function(to, from, except, desc) {
|
|
169
|
+
var __copyProps = function __copyProps(to, from, except, desc) {
|
|
162
170
|
if (from && (typeof from === "undefined" ? "undefined" : _type_of(from)) === "object" || typeof from === "function") {
|
|
163
171
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
164
172
|
try {
|
|
165
173
|
var _loop = function() {
|
|
166
174
|
var key = _step.value;
|
|
167
175
|
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
168
|
-
get: function() {
|
|
176
|
+
get: function get() {
|
|
169
177
|
return from[key];
|
|
170
178
|
},
|
|
171
179
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
@@ -189,7 +197,7 @@ var __copyProps = function(to, from, except, desc) {
|
|
|
189
197
|
}
|
|
190
198
|
return to;
|
|
191
199
|
};
|
|
192
|
-
var __toCommonJS = function(mod) {
|
|
200
|
+
var __toCommonJS = function __toCommonJS(mod) {
|
|
193
201
|
return __copyProps(__defProp({}, "__esModule", {
|
|
194
202
|
value: true
|
|
195
203
|
}), mod);
|
|
@@ -197,7 +205,7 @@ var __toCommonJS = function(mod) {
|
|
|
197
205
|
// src/sdk/prebid.ts
|
|
198
206
|
var prebid_exports = {};
|
|
199
207
|
__export(prebid_exports, {
|
|
200
|
-
createPrebidManager: function() {
|
|
208
|
+
createPrebidManager: function createPrebidManager1() {
|
|
201
209
|
return createPrebidManager;
|
|
202
210
|
}
|
|
203
211
|
});
|
|
@@ -206,8 +214,8 @@ var DEFAULT_TIMEOUT_MS = 3e3;
|
|
|
206
214
|
var AUCTION_URL = "https://sspproxy.adstorm.co/openrtb2/auction/adstorm";
|
|
207
215
|
function createPrebidManager() {
|
|
208
216
|
var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
209
|
-
var initialized = false;
|
|
210
217
|
var _options_debug;
|
|
218
|
+
var initialized = false;
|
|
211
219
|
var debug = (_options_debug = options.debug) !== null && _options_debug !== void 0 ? _options_debug : false;
|
|
212
220
|
function log() {
|
|
213
221
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
package/lib/sdk/prebid.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/ubuntu24/Dev/stormcloud-vp/lib/sdk/prebid.cjs"],"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc"
|
|
1
|
+
{"version":3,"sources":["/home/ubuntu24-new/Dev/stormcloud-vp/lib/sdk/prebid.cjs"],"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IACA,EAAIA,KAAAA,OAAYC,OAAOC,cAAc;oBACjCC,mBAAmBF,OAAOG,wBAAwB;qBAClDC,oBAAoBJ,OAAOK,mBAAmB;QAC9CC,eAAeN,OAAOO,SAAS,CAACC,cAAc;iBAC9CC,WAAW,kBAACC,QAAQC;QACtB,IAAK,IAAIC,QAAQD,KACfZ,UAAUW,QAAQE,MAAM;cAAEC,KAAKF,GAAG,CAACC,KAAK;YAAEE,YAAY;MAAK;AAC/D;AACA,IAAIC,cAAc,qBAACC,IAAIC,MAAMC,QAAQC,IAAAA;IACnC,CAAA,CAAA,EAAIF,KAAAA,GAAQ,CAAA,GAAA,GAAA,CAAOA,qCAAP,SAAOA,KAAG,MAAM,YAAY,OAAOA,SAAS,YAAY;mCAC7D,kCAAA,2BAAA","sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\n\n// src/sdk/prebid.ts\nvar prebid_exports = {};\n__export(prebid_exports, {\n createPrebidManager: () => createPrebidManager\n});\nmodule.exports = __toCommonJS(prebid_exports);\nvar DEFAULT_TIMEOUT_MS = 3e3;\nvar AUCTION_URL = \"https://sspproxy.adstorm.co/openrtb2/auction/adstorm\";\nfunction createPrebidManager(options = {}) {\n let initialized = false;\n const debug = options.debug ?? false;\n function log(...args) {\n if (debug) {\n console.log(\"[Prebid]\", ...args);\n }\n }\n function warn(...args) {\n console.warn(\"[Prebid]\", ...args);\n }\n function parseResponse(data) {\n const bids = [];\n const seatbids = data?.seatbid || [];\n const currency = data?.cur || \"USD\";\n for (const seatbid of seatbids) {\n const seat = seatbid.seat || \"unknown\";\n const bidArray = seatbid.bid || [];\n for (const bid of bidArray) {\n const cacheUrl = bid.ext?.prebid?.cache?.vastXml?.url;\n const vastXml = bid.adm || void 0;\n const bidResponse = {\n bidder: seat,\n cpm: bid.price || 0,\n width: bid.w || 0,\n height: bid.h || 0,\n adId: bid.id || \"\",\n impId: bid.impid || \"\",\n creativeId: bid.crid || \"\",\n currency\n };\n if (cacheUrl) bidResponse.vastUrl = cacheUrl;\n if (vastXml) bidResponse.vastXml = vastXml;\n if (bid.adomain) bidResponse.adomain = bid.adomain;\n bids.push(bidResponse);\n }\n }\n bids.sort((a, b) => b.cpm - a.cpm);\n return bids;\n }\n function extractVastUrl(bids) {\n if (bids.length === 0) return null;\n const winner = bids[0];\n if (winner.vastUrl) {\n log(\n `Using cached VAST URL from ${winner.bidder} ($${winner.cpm.toFixed(2)} ${winner.currency})`\n );\n return winner.vastUrl;\n }\n if (winner.vastXml) {\n log(\n `Creating blob URL from VAST XML (${winner.bidder}, $${winner.cpm.toFixed(2)})`\n );\n try {\n const blob = new Blob([winner.vastXml], { type: \"text/xml\" });\n return URL.createObjectURL(blob);\n } catch (error) {\n warn(\"Failed to create blob URL from VAST XML:\", error);\n }\n }\n return null;\n }\n async function initialize() {\n if (initialized) return;\n initialized = true;\n log(\"Initialized, auction URL:\", AUCTION_URL);\n }\n async function requestBids() {\n if (!initialized) {\n throw new Error(\"Prebid not initialized. Call initialize() first.\");\n }\n const timeout = DEFAULT_TIMEOUT_MS;\n log(\"Fetching auction response from:\", AUCTION_URL);\n const controller = typeof AbortController !== \"undefined\" ? new AbortController() : null;\n const timeoutId = setTimeout(() => {\n controller?.abort();\n }, timeout + 2e3);\n try {\n const fetchOptions = {\n method: \"POST\"\n };\n if (controller) {\n fetchOptions.signal = controller.signal;\n }\n const response = await fetch(AUCTION_URL, fetchOptions);\n clearTimeout(timeoutId);\n if (!response.ok) {\n const body = await response.text().catch(() => \"\");\n throw new Error(\n `Prebid Server returned HTTP ${response.status}: ${body.slice(0, 200)}`\n );\n }\n const data = await response.json();\n if (debug && data?.ext?.responsetimemillis) {\n log(\"Bidder response times:\", data.ext.responsetimemillis);\n }\n if (debug && data?.ext?.errors) {\n warn(\"Auction errors:\", data.ext.errors);\n }\n const bids = parseResponse(data);\n log(`Received ${bids.length} bid(s)`);\n if (debug) {\n for (const b of bids) {\n log(\n ` ${b.bidder}: $${b.cpm.toFixed(2)} ${b.currency} ${b.width}x${b.height}` + (b.vastUrl ? \" [cached VAST]\" : \"\") + (b.vastXml && !b.vastUrl ? \" [VAST XML]\" : \"\")\n );\n }\n }\n return bids;\n } catch (error) {\n clearTimeout(timeoutId);\n if (error?.name === \"AbortError\") {\n warn(`Auction request timed out after ${timeout + 2e3}ms`);\n return [];\n }\n throw error;\n }\n }\n async function getVastUrl() {\n try {\n const bids = await requestBids();\n return extractVastUrl(bids);\n } catch (error) {\n warn(\"Failed to get VAST URL:\", error);\n return null;\n }\n }\n function destroy() {\n initialized = false;\n log(\"Destroyed\");\n }\n return {\n initialize,\n requestBids,\n getVastUrl,\n destroy,\n get isInitialized() {\n return initialized;\n }\n };\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n createPrebidManager\n});\n"]}
|
|
@@ -118,9 +118,17 @@ function _ts_generator(thisArg, body) {
|
|
|
118
118
|
},
|
|
119
119
|
trys: [],
|
|
120
120
|
ops: []
|
|
121
|
-
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
122
|
-
return
|
|
123
|
-
|
|
121
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
|
|
122
|
+
return d(g, "next", {
|
|
123
|
+
value: verb(0)
|
|
124
|
+
}), d(g, "throw", {
|
|
125
|
+
value: verb(1)
|
|
126
|
+
}), d(g, "return", {
|
|
127
|
+
value: verb(2)
|
|
128
|
+
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
129
|
+
value: function() {
|
|
130
|
+
return this;
|
|
131
|
+
}
|
|
124
132
|
}), g;
|
|
125
133
|
function verb(n) {
|
|
126
134
|
return function(v) {
|
|
@@ -206,20 +214,20 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
206
214
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
207
215
|
var __getProtoOf = Object.getPrototypeOf;
|
|
208
216
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
209
|
-
var __export = function(target, all) {
|
|
217
|
+
var __export = function __export(target, all) {
|
|
210
218
|
for(var name in all)__defProp(target, name, {
|
|
211
219
|
get: all[name],
|
|
212
220
|
enumerable: true
|
|
213
221
|
});
|
|
214
222
|
};
|
|
215
|
-
var __copyProps = function(to, from, except, desc) {
|
|
223
|
+
var __copyProps = function __copyProps(to, from, except, desc) {
|
|
216
224
|
if (from && (typeof from === "undefined" ? "undefined" : _type_of(from)) === "object" || typeof from === "function") {
|
|
217
225
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
218
226
|
try {
|
|
219
227
|
var _loop = function() {
|
|
220
228
|
var key = _step.value;
|
|
221
229
|
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
222
|
-
get: function() {
|
|
230
|
+
get: function get() {
|
|
223
231
|
return from[key];
|
|
224
232
|
},
|
|
225
233
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
@@ -243,7 +251,7 @@ var __copyProps = function(to, from, except, desc) {
|
|
|
243
251
|
}
|
|
244
252
|
return to;
|
|
245
253
|
};
|
|
246
|
-
var __toESM = function(mod, isNodeMode, target) {
|
|
254
|
+
var __toESM = function __toESM(mod, isNodeMode, target) {
|
|
247
255
|
return target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(// If the importer is in node compatibility mode or this is not an ESM
|
|
248
256
|
// file that has been converted to a CommonJS file using a Babel-
|
|
249
257
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
@@ -253,7 +261,7 @@ var __toESM = function(mod, isNodeMode, target) {
|
|
|
253
261
|
enumerable: true
|
|
254
262
|
}) : target, mod);
|
|
255
263
|
};
|
|
256
|
-
var __toCommonJS = function(mod) {
|
|
264
|
+
var __toCommonJS = function __toCommonJS(mod) {
|
|
257
265
|
return __copyProps(__defProp({}, "__esModule", {
|
|
258
266
|
value: true
|
|
259
267
|
}), mod);
|
|
@@ -261,7 +269,7 @@ var __toCommonJS = function(mod) {
|
|
|
261
269
|
// src/sdk/prebidController.ts
|
|
262
270
|
var prebidController_exports = {};
|
|
263
271
|
__export(prebidController_exports, {
|
|
264
|
-
createPrebidController: function() {
|
|
272
|
+
createPrebidController: function createPrebidController1() {
|
|
265
273
|
return createPrebidController;
|
|
266
274
|
}
|
|
267
275
|
});
|
|
@@ -469,8 +477,8 @@ var DEFAULT_TIMEOUT_MS = 3e3;
|
|
|
469
477
|
var AUCTION_URL = "https://sspproxy.adstorm.co/openrtb2/auction/adstorm";
|
|
470
478
|
function createPrebidManager() {
|
|
471
479
|
var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
472
|
-
var initialized = false;
|
|
473
480
|
var _options_debug;
|
|
481
|
+
var initialized = false;
|
|
474
482
|
var debug = (_options_debug = options.debug) !== null && _options_debug !== void 0 ? _options_debug : false;
|
|
475
483
|
function log() {
|
|
476
484
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
@@ -972,13 +980,15 @@ function createPrebidController(contentVideo, options) {
|
|
|
972
980
|
adContainerEl.style.display = "none";
|
|
973
981
|
adContainerEl.style.pointerEvents = "none";
|
|
974
982
|
}
|
|
983
|
+
contentVideo.style.visibility = "visible";
|
|
984
|
+
contentVideo.style.opacity = "1";
|
|
975
985
|
if (options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds) {
|
|
976
986
|
if (contentVideo.paused) {
|
|
977
987
|
console.log("".concat(LOG, " Content video paused in live mode, resuming playback"));
|
|
978
|
-
contentVideo.play().catch(function() {});
|
|
979
988
|
} else {
|
|
980
989
|
console.log("".concat(LOG, " Content video already playing in live mode"));
|
|
981
990
|
}
|
|
991
|
+
contentVideo.play().catch(function() {});
|
|
982
992
|
}
|
|
983
993
|
emit("content_resume");
|
|
984
994
|
}
|
|
@@ -1344,8 +1354,8 @@ function createPrebidController(contentVideo, options) {
|
|
|
1344
1354
|
if (options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds) {
|
|
1345
1355
|
if (contentVideo.paused) {
|
|
1346
1356
|
console.log("".concat(LOG, " Content video paused in live mode, resuming playback on stop"));
|
|
1347
|
-
contentVideo.play().catch(function() {});
|
|
1348
1357
|
}
|
|
1358
|
+
contentVideo.play().catch(function() {});
|
|
1349
1359
|
}
|
|
1350
1360
|
if (adHls) {
|
|
1351
1361
|
adHls.destroy();
|
|
@@ -1354,6 +1364,8 @@ function createPrebidController(contentVideo, options) {
|
|
|
1354
1364
|
if (adVideoElement) {
|
|
1355
1365
|
adVideoElement.pause();
|
|
1356
1366
|
adVideoElement.src = "";
|
|
1367
|
+
adVideoElement.remove();
|
|
1368
|
+
adVideoElement = void 0;
|
|
1357
1369
|
}
|
|
1358
1370
|
currentAd = void 0;
|
|
1359
1371
|
return [
|