stormcloud-video-player 0.8.56 → 0.8.58
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/README.md +2 -2
- package/dist/stormcloud-vp.min.js +1 -3
- package/lib/player/AdBreakOrchestrator.cjs +118 -188
- package/lib/player/AdBreakOrchestrator.cjs.map +1 -1
- package/lib/player/AdConfigManager.cjs +141 -273
- package/lib/player/AdConfigManager.cjs.map +1 -1
- package/lib/player/AdConfigManager.d.cts +1 -1
- package/lib/player/AdTimingService.cjs.map +1 -1
- package/lib/player/HlsEngine.cjs.map +1 -1
- package/lib/player/PlaceholderLayer.cjs.map +1 -1
- package/lib/player/PlayerControls.cjs.map +1 -1
- package/lib/player/Scte35CueManager.cjs.map +1 -1
- package/lib/player/Scte35Parser.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +178 -281
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/playerTypes.cjs.map +1 -1
- package/lib/players/FilePlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.cjs +178 -281
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +178 -281
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.cjs.map +1 -1
- package/lib/sdk/pal.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +178 -281
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/utils/browserCompat.cjs.map +1 -1
- package/lib/utils/ctvVastSignals.cjs +30 -36
- package/lib/utils/ctvVastSignals.cjs.map +1 -1
- package/lib/utils/devUrl.cjs.map +1 -1
- package/lib/utils/polyfills.cjs.map +1 -1
- package/lib/utils/tracking.cjs +134 -199
- package/lib/utils/tracking.cjs.map +1 -1
- package/lib/utils/trackingIngest.cjs +322 -0
- package/lib/utils/trackingIngest.cjs.map +1 -0
- package/lib/utils/trackingIngest.d.cts +14 -0
- package/lib/utils/vastEnvironmentSignals.cjs +16 -36
- package/lib/utils/vastEnvironmentSignals.cjs.map +1 -1
- package/lib/utils/vastEnvironmentSignals.d.cts +0 -3
- package/lib/utils/vastMacros.cjs +10 -34
- package/lib/utils/vastMacros.cjs.map +1 -1
- package/lib/utils/vastMacros.d.cts +0 -3
- package/lib/utils/vastTrackingMacros.cjs.map +1 -1
- package/package.json +1 -3
- package/lib/index.cjs +0 -12586
- package/lib/index.cjs.map +0 -1
- package/lib/index.d.cts +0 -4048
- package/lib/index.d.ts +0 -4048
- package/lib/index.js +0 -12327
- package/lib/index.js.map +0 -1
- package/lib/utils/mqttClient.cjs +0 -305
- package/lib/utils/mqttClient.cjs.map +0 -1
- package/lib/utils/mqttClient.d.cts +0 -13
- package/lib/utils/mqttConfig.cjs +0 -139
- package/lib/utils/mqttConfig.cjs.map +0 -1
- package/lib/utils/mqttConfig.d.cts +0 -20
- package/src/certs/emqxsl-ca.crt +0 -22
|
@@ -254,11 +254,9 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
254
254
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
255
255
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
256
256
|
}
|
|
257
|
-
var __create = Object.create;
|
|
258
257
|
var __defProp = Object.defineProperty;
|
|
259
258
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
260
259
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
261
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
262
260
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
263
261
|
var __export = function __export(target, all) {
|
|
264
262
|
for(var name in all)__defProp(target, name, {
|
|
@@ -297,16 +295,6 @@ var __copyProps = function __copyProps(to, from, except, desc) {
|
|
|
297
295
|
}
|
|
298
296
|
return to;
|
|
299
297
|
};
|
|
300
|
-
var __toESM = function __toESM(mod, isNodeMode, target) {
|
|
301
|
-
return target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(// If the importer is in node compatibility mode or this is not an ESM
|
|
302
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
303
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
304
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
305
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
306
|
-
value: mod,
|
|
307
|
-
enumerable: true
|
|
308
|
-
}) : target, mod);
|
|
309
|
-
};
|
|
310
298
|
var __toCommonJS = function __toCommonJS(mod) {
|
|
311
299
|
return __copyProps(__defProp({}, "__esModule", {
|
|
312
300
|
value: true
|
|
@@ -321,34 +309,8 @@ __export(AdConfigManager_exports, {
|
|
|
321
309
|
});
|
|
322
310
|
module.exports = __toCommonJS(AdConfigManager_exports);
|
|
323
311
|
// src/utils/vastEnvironmentSignals.ts
|
|
324
|
-
var AIRY_ANDROID_APP_ID = "com.freeairytv.android";
|
|
325
|
-
var AIRY_WEBOS_APP_ID = "com.freeairytv.webos";
|
|
326
|
-
var AIRY_TIZEN_APP_ID = "com.freeairytv.samsung";
|
|
327
|
-
var AIRY_ROKU_APP_ID = "com.freeairytv.roku";
|
|
328
|
-
var AIRY_APP_NAME = "AiryTV Movies & TV";
|
|
329
|
-
var AIRY_DEFAULT_CONTENT_URL = "https://live.airy.tv";
|
|
330
312
|
var CTV_SESSION_STORAGE_KEY = "stormcloud.ctv.sid";
|
|
331
313
|
var PLAYER_ID_STORAGE_KEY = "stormcloud.player.id";
|
|
332
|
-
var LG_TEST_APP_ID = "com.hulu.plus";
|
|
333
|
-
var LG_TEST_APP_NAME = "Hulu";
|
|
334
|
-
var LG_TEST_CONTENT_URL = "https://www.hulu.com/live-tv";
|
|
335
|
-
var _lgTestDeviceId;
|
|
336
|
-
function getLgTestDeviceId() {
|
|
337
|
-
if (!_lgTestDeviceId) _lgTestDeviceId = createUuid();
|
|
338
|
-
return _lgTestDeviceId;
|
|
339
|
-
}
|
|
340
|
-
function isLgWebOS() {
|
|
341
|
-
if (typeof navigator === "undefined") return false;
|
|
342
|
-
return /Web0S|webOS|LG Browser|LGSTB|LGE/i.test(navigator.userAgent);
|
|
343
|
-
}
|
|
344
|
-
function getDefaultAppId() {
|
|
345
|
-
if (typeof navigator === "undefined") return AIRY_ANDROID_APP_ID;
|
|
346
|
-
var ua = navigator.userAgent;
|
|
347
|
-
if (/Web0S|webOS|LG Browser|LGSTB|LGE/i.test(ua)) return AIRY_WEBOS_APP_ID;
|
|
348
|
-
if (/Tizen|Samsung/i.test(ua)) return AIRY_TIZEN_APP_ID;
|
|
349
|
-
if (/Roku/i.test(ua)) return AIRY_ROKU_APP_ID;
|
|
350
|
-
return AIRY_ANDROID_APP_ID;
|
|
351
|
-
}
|
|
352
314
|
var DEVICE_ID_STORAGE_KEYS = [
|
|
353
315
|
"rdid",
|
|
354
316
|
"ifa",
|
|
@@ -369,23 +331,29 @@ function resolveVastEnvironmentSignals(isCtv) {
|
|
|
369
331
|
var _ref;
|
|
370
332
|
var bridgeSignals = readNativeBridgeSignals();
|
|
371
333
|
var platformDevice = readPlatformNativeDeviceId();
|
|
372
|
-
var
|
|
373
|
-
var deviceId =
|
|
374
|
-
var deviceIdType = bridgeSignals.deviceIdType || readStoredString("deviceIdType") || readStoredString("idtype") || platformDevice.deviceIdType || inferDeviceIdType()
|
|
334
|
+
var realDeviceId = bridgeSignals.deviceId || readStoredDeviceId() || platformDevice.deviceId;
|
|
335
|
+
var deviceId = realDeviceId;
|
|
336
|
+
var deviceIdType = bridgeSignals.deviceIdType || readStoredString("deviceIdType") || readStoredString("idtype") || platformDevice.deviceIdType || inferDeviceIdType();
|
|
375
337
|
var platformLat = bridgeSignals.deviceId ? bridgeSignals.limitAdTracking : platformDevice.limitAdTracking;
|
|
376
338
|
var limitAdTracking = deviceId != null ? (_ref = platformLat !== null && platformLat !== void 0 ? platformLat : readStoredLimitAdTracking()) !== null && _ref !== void 0 ? _ref : false : void 0;
|
|
339
|
+
if (!deviceId && isCtv) {
|
|
340
|
+
var dpid = getOrCreateStoredUuid(PLAYER_ID_STORAGE_KEY);
|
|
341
|
+
if (dpid) {
|
|
342
|
+
var _ref1;
|
|
343
|
+
deviceId = dpid;
|
|
344
|
+
deviceIdType = "dpid";
|
|
345
|
+
limitAdTracking = (_ref1 = platformLat !== null && platformLat !== void 0 ? platformLat : readStoredLimitAdTracking()) !== null && _ref1 !== void 0 ? _ref1 : false;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
377
348
|
if (isCtv) {
|
|
378
349
|
return _object_spread_props(_object_spread({
|
|
379
350
|
isCtv: true,
|
|
380
|
-
contentUrl: bridgeSignals.contentUrl || readStoredString("contentUrl") || (lg ? LG_TEST_CONTENT_URL : AIRY_DEFAULT_CONTENT_URL),
|
|
381
|
-
appId: bridgeSignals.appId || readStoredString("appId") || readStoredString("msid") || (lg ? LG_TEST_APP_ID : getDefaultAppId()),
|
|
382
|
-
appName: bridgeSignals.appName || readStoredString("appName") || readStoredString("an") || (lg ? LG_TEST_APP_NAME : AIRY_APP_NAME),
|
|
383
351
|
sessionId: getOrCreateCtvSessionId()
|
|
384
352
|
}, deviceId ? {
|
|
385
353
|
deviceId: deviceId
|
|
386
|
-
} : {}, deviceIdType ? {
|
|
354
|
+
} : {}, deviceId && deviceIdType ? {
|
|
387
355
|
deviceIdType: deviceIdType
|
|
388
|
-
} : {}, limitAdTracking != null ? {
|
|
356
|
+
} : {}, deviceId && limitAdTracking != null ? {
|
|
389
357
|
limitAdTracking: limitAdTracking
|
|
390
358
|
} : {}), {
|
|
391
359
|
deviceTypeHint: 5
|
|
@@ -395,9 +363,9 @@ function resolveVastEnvironmentSignals(isCtv) {
|
|
|
395
363
|
isCtv: false
|
|
396
364
|
}, deviceId ? {
|
|
397
365
|
deviceId: deviceId
|
|
398
|
-
} : {}, deviceIdType ? {
|
|
366
|
+
} : {}, deviceId && deviceIdType ? {
|
|
399
367
|
deviceIdType: deviceIdType
|
|
400
|
-
} : {}, limitAdTracking != null ? {
|
|
368
|
+
} : {}, deviceId && limitAdTracking != null ? {
|
|
401
369
|
limitAdTracking: limitAdTracking
|
|
402
370
|
} : {});
|
|
403
371
|
}
|
|
@@ -828,7 +796,6 @@ var UNEXPANDED_MACRO_PATTERN = /^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%)$/;
|
|
|
828
796
|
var INVALID_VAST_PARAM_KEY = /^\s|\s$/;
|
|
829
797
|
var EXAMPLE_COM_URL = /example\.com/i;
|
|
830
798
|
var CTV_UNSUPPORTED_PARAMS = [
|
|
831
|
-
"description_url",
|
|
832
799
|
"tfcd",
|
|
833
800
|
"npa",
|
|
834
801
|
"min_ad_duration",
|
|
@@ -919,18 +886,6 @@ var INLINE_DEVICE_MACRO_REPLACEMENTS = [
|
|
|
919
886
|
return ctx.limitAdTracking != null ? ctx.limitAdTracking ? "1" : "0" : void 0;
|
|
920
887
|
}
|
|
921
888
|
},
|
|
922
|
-
{
|
|
923
|
-
pattern: /%%MSID%%/gi,
|
|
924
|
-
getValue: function getValue(ctx) {
|
|
925
|
-
return ctx.appId;
|
|
926
|
-
}
|
|
927
|
-
},
|
|
928
|
-
{
|
|
929
|
-
pattern: /%%APP_NAME%%/gi,
|
|
930
|
-
getValue: function getValue(ctx) {
|
|
931
|
-
return ctx.appName;
|
|
932
|
-
}
|
|
933
|
-
},
|
|
934
889
|
{
|
|
935
890
|
pattern: /%%SESSION_ID%%/gi,
|
|
936
891
|
getValue: function getValue(ctx) {
|
|
@@ -1121,7 +1076,7 @@ function applyVastMacros(baseUrl, ctx) {
|
|
|
1121
1076
|
return replaceCorrelatorFallback(expandedUrl, ctx.correlator);
|
|
1122
1077
|
}
|
|
1123
1078
|
var params = url.searchParams;
|
|
1124
|
-
removeBrokenAppNameOrphans(params
|
|
1079
|
+
removeBrokenAppNameOrphans(params);
|
|
1125
1080
|
params.set("correlator", ctx.correlator);
|
|
1126
1081
|
params.set("scor", ctx.streamCorrelator);
|
|
1127
1082
|
if (ctx.isCtv) {
|
|
@@ -1160,18 +1115,14 @@ function applyVastMacros(baseUrl, ctx) {
|
|
|
1160
1115
|
if (ctx.podMaxAds != null) {
|
|
1161
1116
|
params.set("pmad", String(Math.max(1, Math.round(ctx.podMaxAds))));
|
|
1162
1117
|
}
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
params.set("
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
if (EXAMPLE_COM_URL.test(existingUrl)) {
|
|
1172
|
-
params.delete("url");
|
|
1173
|
-
params.delete("description_url");
|
|
1174
|
-
}
|
|
1118
|
+
if (!ctx.isCtv && ctx.pageUrl) {
|
|
1119
|
+
params.set("url", ctx.pageUrl);
|
|
1120
|
+
params.set("description_url", ctx.pageUrl);
|
|
1121
|
+
}
|
|
1122
|
+
var existingUrl = params.get("url") || "";
|
|
1123
|
+
if (EXAMPLE_COM_URL.test(existingUrl)) {
|
|
1124
|
+
params.delete("url");
|
|
1125
|
+
params.delete("description_url");
|
|
1175
1126
|
}
|
|
1176
1127
|
if (ctx.adWillPlayMuted != null) {
|
|
1177
1128
|
params.set("vpmute", ctx.adWillPlayMuted ? "1" : "0");
|
|
@@ -1179,13 +1130,6 @@ function applyVastMacros(baseUrl, ctx) {
|
|
|
1179
1130
|
if (ctx.adWillAutoPlay != null) {
|
|
1180
1131
|
params.set("vpa", ctx.adWillAutoPlay ? "auto" : "click");
|
|
1181
1132
|
}
|
|
1182
|
-
if (ctx.appId) {
|
|
1183
|
-
params.set("msid", ctx.appId);
|
|
1184
|
-
}
|
|
1185
|
-
if (ctx.appName) {
|
|
1186
|
-
removeBrokenAppNameOrphans(params, ctx.appName);
|
|
1187
|
-
params.set("an", ctx.appName);
|
|
1188
|
-
}
|
|
1189
1133
|
if (ctx.sessionId) {
|
|
1190
1134
|
params.set("sid", ctx.sessionId);
|
|
1191
1135
|
}
|
|
@@ -1236,7 +1180,7 @@ function applyVastMacros(baseUrl, ctx) {
|
|
|
1236
1180
|
}
|
|
1237
1181
|
}
|
|
1238
1182
|
}
|
|
1239
|
-
removeBrokenAppNameOrphans(params
|
|
1183
|
+
removeBrokenAppNameOrphans(params);
|
|
1240
1184
|
return url.toString();
|
|
1241
1185
|
}
|
|
1242
1186
|
function replaceCorrelatorFallback(baseUrl, correlator) {
|
|
@@ -1282,163 +1226,83 @@ function toDevSafeUrl(rawUrl) {
|
|
|
1282
1226
|
var cleanPath = url.pathname.replace(/\/{2,}/g, "/") || "/index.html";
|
|
1283
1227
|
return "file://".concat(cleanPath);
|
|
1284
1228
|
}
|
|
1285
|
-
// src/utils/
|
|
1286
|
-
var
|
|
1229
|
+
// src/utils/trackingIngest.ts
|
|
1230
|
+
var DEFAULT_TRACKING_INGEST_CONFIG = {
|
|
1287
1231
|
enabled: true,
|
|
1288
|
-
|
|
1289
|
-
brokerPort: 8883,
|
|
1290
|
-
wsPort: 8084,
|
|
1291
|
-
username: "for-sonifi",
|
|
1292
|
-
password: "sonifi-mqtt",
|
|
1293
|
-
topicPrefix: "adstorm/players",
|
|
1294
|
-
qos: 1
|
|
1232
|
+
baseUrl: "https://player-analytics-ingest-api-760490581852.us-central1.run.app/api/adstorm/player-tracking"
|
|
1295
1233
|
};
|
|
1296
|
-
var
|
|
1297
|
-
function
|
|
1298
|
-
|
|
1299
|
-
}
|
|
1300
|
-
function isMQTTEnabled() {
|
|
1301
|
-
return mqttConfig.enabled;
|
|
1302
|
-
}
|
|
1303
|
-
function buildMQTTBrokerUrl() {
|
|
1304
|
-
if (mqttConfig.brokerUrl) return mqttConfig.brokerUrl;
|
|
1305
|
-
return "wss://".concat(mqttConfig.brokerAddress, ":").concat(mqttConfig.wsPort, "/mqtt");
|
|
1306
|
-
}
|
|
1307
|
-
function buildPlayerTopic(licenseKey, channel) {
|
|
1308
|
-
return "".concat(mqttConfig.topicPrefix, "/").concat(licenseKey, "/").concat(channel);
|
|
1309
|
-
}
|
|
1310
|
-
// src/utils/mqttClient.ts
|
|
1311
|
-
var import_mqtt = __toESM(require("mqtt"), 1);
|
|
1312
|
-
var LOG = "[StormcloudVideoPlayer][MQTT]";
|
|
1313
|
-
var KEEPALIVE_SECONDS = 30;
|
|
1314
|
-
var CONNECT_TIMEOUT_MS = 1e4;
|
|
1315
|
-
var RECONNECT_BASE_MS = 5e3;
|
|
1316
|
-
var RECONNECT_MAX_MS = 6e4;
|
|
1317
|
-
var MAX_RECONNECT_ATTEMPTS = 8;
|
|
1318
|
-
var COOLDOWN_MS = 10 * 6e4;
|
|
1319
|
-
var client = null;
|
|
1320
|
-
var status = "disconnected";
|
|
1321
|
-
var reconnectAttempts = 0;
|
|
1322
|
-
var reconnectTimer = null;
|
|
1323
|
-
var stopped = false;
|
|
1324
|
-
function clearReconnectTimer() {
|
|
1325
|
-
if (reconnectTimer) {
|
|
1326
|
-
clearTimeout(reconnectTimer);
|
|
1327
|
-
reconnectTimer = null;
|
|
1328
|
-
}
|
|
1329
|
-
}
|
|
1330
|
-
function teardownClient() {
|
|
1331
|
-
if (client) {
|
|
1332
|
-
try {
|
|
1333
|
-
client.removeAllListeners();
|
|
1334
|
-
client.end(true);
|
|
1335
|
-
} catch (unused) {}
|
|
1336
|
-
client = null;
|
|
1337
|
-
}
|
|
1338
|
-
}
|
|
1339
|
-
function scheduleReconnect() {
|
|
1340
|
-
if (stopped || !isMQTTEnabled() || reconnectTimer) return;
|
|
1341
|
-
if (reconnectAttempts >= MAX_RECONNECT_ATTEMPTS) {
|
|
1342
|
-
console.warn("".concat(LOG, " giving up after ").concat(reconnectAttempts, " attempts; cooling down for ").concat(COOLDOWN_MS / 6e4, "m"));
|
|
1343
|
-
teardownClient();
|
|
1344
|
-
status = "disconnected";
|
|
1345
|
-
reconnectTimer = setTimeout(function() {
|
|
1346
|
-
reconnectTimer = null;
|
|
1347
|
-
reconnectAttempts = 0;
|
|
1348
|
-
openConnection();
|
|
1349
|
-
}, COOLDOWN_MS);
|
|
1350
|
-
return;
|
|
1351
|
-
}
|
|
1352
|
-
var delay = Math.min(RECONNECT_MAX_MS, RECONNECT_BASE_MS * Math.pow(2, reconnectAttempts));
|
|
1353
|
-
var jitter = Math.floor(Math.random() * 1e3);
|
|
1354
|
-
reconnectAttempts += 1;
|
|
1355
|
-
reconnectTimer = setTimeout(function() {
|
|
1356
|
-
reconnectTimer = null;
|
|
1357
|
-
openConnection();
|
|
1358
|
-
}, delay + jitter);
|
|
1359
|
-
}
|
|
1360
|
-
function openConnection() {
|
|
1361
|
-
if (stopped || !isMQTTEnabled()) return;
|
|
1362
|
-
teardownClient();
|
|
1363
|
-
var url = buildMQTTBrokerUrl();
|
|
1364
|
-
status = "connecting";
|
|
1365
|
-
var clientId = "stormcloud-vp-".concat(Math.random().toString(36).slice(2, 9));
|
|
1366
|
-
try {
|
|
1367
|
-
client = import_mqtt.default.connect(url, {
|
|
1368
|
-
clientId: clientId,
|
|
1369
|
-
username: mqttConfig.username,
|
|
1370
|
-
password: mqttConfig.password,
|
|
1371
|
-
keepalive: KEEPALIVE_SECONDS,
|
|
1372
|
-
clean: true,
|
|
1373
|
-
// Disable MQTT.js internal reconnect; we manage reconnection ourselves.
|
|
1374
|
-
reconnectPeriod: 0,
|
|
1375
|
-
connectTimeout: CONNECT_TIMEOUT_MS,
|
|
1376
|
-
queueQoSZero: false,
|
|
1377
|
-
reschedulePings: true,
|
|
1378
|
-
// Root-cause fix for the Tizen 4.0 "Keepalive timeout" loop: MQTT.js's
|
|
1379
|
-
// default timerVariant "auto" runs the keepalive interval inside a
|
|
1380
|
-
// Blob-URL Web Worker (via worker-timers). On Samsung Tizen 4.0 (old
|
|
1381
|
-
// WebKit) served from a file:// origin that worker can't tick reliably,
|
|
1382
|
-
// so the keepalive counter trips onKeepaliveTimeout almost immediately
|
|
1383
|
-
// after connect. Force the native setInterval timer instead; the main
|
|
1384
|
-
// thread is free because video is decoded by the native AVPlay pipeline.
|
|
1385
|
-
timerVariant: "native"
|
|
1386
|
-
});
|
|
1387
|
-
} catch (err) {
|
|
1388
|
-
status = "error";
|
|
1389
|
-
console.warn("".concat(LOG, " connect() threw:"), err);
|
|
1390
|
-
scheduleReconnect();
|
|
1391
|
-
return;
|
|
1392
|
-
}
|
|
1393
|
-
client.on("connect", function() {
|
|
1394
|
-
status = "connected";
|
|
1395
|
-
reconnectAttempts = 0;
|
|
1396
|
-
clearReconnectTimer();
|
|
1397
|
-
console.info("".concat(LOG, " connected to ").concat(url));
|
|
1398
|
-
});
|
|
1399
|
-
client.on("offline", function() {
|
|
1400
|
-
if (status === "connected") status = "disconnected";
|
|
1401
|
-
console.warn("".concat(LOG, " offline"));
|
|
1402
|
-
scheduleReconnect();
|
|
1403
|
-
});
|
|
1404
|
-
client.on("error", function(err) {
|
|
1405
|
-
status = "error";
|
|
1406
|
-
console.warn("".concat(LOG, " error:"), err.message);
|
|
1407
|
-
scheduleReconnect();
|
|
1408
|
-
});
|
|
1409
|
-
client.on("close", function() {
|
|
1410
|
-
if (status === "connected") status = "disconnected";
|
|
1411
|
-
scheduleReconnect();
|
|
1412
|
-
});
|
|
1234
|
+
var trackingIngestConfig = _object_spread({}, DEFAULT_TRACKING_INGEST_CONFIG);
|
|
1235
|
+
function isTrackingIngestEnabled() {
|
|
1236
|
+
return trackingIngestConfig.enabled === true;
|
|
1413
1237
|
}
|
|
1414
|
-
function
|
|
1415
|
-
|
|
1416
|
-
stopped = false;
|
|
1417
|
-
reconnectAttempts = 0;
|
|
1418
|
-
openConnection();
|
|
1238
|
+
function normalizeIngestBaseUrl(baseUrl) {
|
|
1239
|
+
return baseUrl.replace(/\/+$/, "");
|
|
1419
1240
|
}
|
|
1420
|
-
function
|
|
1421
|
-
|
|
1422
|
-
|
|
1241
|
+
function buildTrackingIngestUrl(channel) {
|
|
1242
|
+
var base = normalizeIngestBaseUrl(trackingIngestConfig.baseUrl);
|
|
1243
|
+
if (channel === "impressions") {
|
|
1244
|
+
return "".concat(base, "/impressions/ingest");
|
|
1423
1245
|
}
|
|
1246
|
+
return "".concat(base, "/metrics/ingest");
|
|
1424
1247
|
}
|
|
1425
|
-
function
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1248
|
+
function ingestPlayerTracking(licenseKey, channel, body) {
|
|
1249
|
+
return _async_to_generator(function() {
|
|
1250
|
+
var response, error;
|
|
1251
|
+
return _ts_generator(this, function(_state) {
|
|
1252
|
+
switch(_state.label){
|
|
1253
|
+
case 0:
|
|
1254
|
+
if (!isTrackingIngestEnabled() || !licenseKey) {
|
|
1255
|
+
return [
|
|
1256
|
+
2,
|
|
1257
|
+
false
|
|
1258
|
+
];
|
|
1259
|
+
}
|
|
1260
|
+
_state.label = 1;
|
|
1261
|
+
case 1:
|
|
1262
|
+
_state.trys.push([
|
|
1263
|
+
1,
|
|
1264
|
+
3,
|
|
1265
|
+
,
|
|
1266
|
+
4
|
|
1267
|
+
]);
|
|
1268
|
+
return [
|
|
1269
|
+
4,
|
|
1270
|
+
fetch(buildTrackingIngestUrl(channel), {
|
|
1271
|
+
method: "POST",
|
|
1272
|
+
headers: {
|
|
1273
|
+
"Content-Type": "application/json",
|
|
1274
|
+
Authorization: "License-Key ".concat(licenseKey)
|
|
1275
|
+
},
|
|
1276
|
+
body: JSON.stringify(body)
|
|
1277
|
+
})
|
|
1278
|
+
];
|
|
1279
|
+
case 2:
|
|
1280
|
+
response = _state.sent();
|
|
1281
|
+
if (!response.ok) {
|
|
1282
|
+
console.warn("[StormcloudVideoPlayer] Tracking ingest failed (".concat(response.status, ") for ").concat(channel));
|
|
1283
|
+
return [
|
|
1284
|
+
2,
|
|
1285
|
+
false
|
|
1286
|
+
];
|
|
1287
|
+
}
|
|
1288
|
+
return [
|
|
1289
|
+
2,
|
|
1290
|
+
true
|
|
1291
|
+
];
|
|
1292
|
+
case 3:
|
|
1293
|
+
error = _state.sent();
|
|
1294
|
+
console.warn("[StormcloudVideoPlayer] Tracking ingest error for ".concat(channel, ":"), error);
|
|
1295
|
+
return [
|
|
1296
|
+
2,
|
|
1297
|
+
false
|
|
1298
|
+
];
|
|
1299
|
+
case 4:
|
|
1300
|
+
return [
|
|
1301
|
+
2
|
|
1302
|
+
];
|
|
1303
|
+
}
|
|
1436
1304
|
});
|
|
1437
|
-
|
|
1438
|
-
} catch (err) {
|
|
1439
|
-
console.warn("".concat(LOG, " publish failed on ").concat(topic, ":"), err);
|
|
1440
|
-
return false;
|
|
1441
|
-
}
|
|
1305
|
+
})();
|
|
1442
1306
|
}
|
|
1443
1307
|
// src/utils/tracking.ts
|
|
1444
1308
|
var cachedBrowserId = null;
|
|
@@ -1706,7 +1570,7 @@ function getBrowserID(clientInfo) {
|
|
|
1706
1570
|
})();
|
|
1707
1571
|
}
|
|
1708
1572
|
function canPublish(licenseKey) {
|
|
1709
|
-
return Boolean(
|
|
1573
|
+
return Boolean(isTrackingIngestEnabled() && licenseKey);
|
|
1710
1574
|
}
|
|
1711
1575
|
function buildPlayerMetricEvent() {
|
|
1712
1576
|
return _async_to_generator(function() {
|
|
@@ -1748,10 +1612,6 @@ function buildPlayerMetricEvent() {
|
|
|
1748
1612
|
});
|
|
1749
1613
|
}).apply(this, arguments);
|
|
1750
1614
|
}
|
|
1751
|
-
function publishTracking(licenseKey, channel, body) {
|
|
1752
|
-
ensureMQTTClient();
|
|
1753
|
-
publishMQTT(buildPlayerTopic(licenseKey, channel), body);
|
|
1754
|
-
}
|
|
1755
1615
|
function sendInitialTracking(_0) {
|
|
1756
1616
|
return _async_to_generator(function(licenseKey) {
|
|
1757
1617
|
var context, metricEvent, error;
|
|
@@ -1767,9 +1627,9 @@ function sendInitialTracking(_0) {
|
|
|
1767
1627
|
case 1:
|
|
1768
1628
|
_state.trys.push([
|
|
1769
1629
|
1,
|
|
1770
|
-
|
|
1630
|
+
4,
|
|
1771
1631
|
,
|
|
1772
|
-
|
|
1632
|
+
5
|
|
1773
1633
|
]);
|
|
1774
1634
|
return [
|
|
1775
1635
|
4,
|
|
@@ -1780,23 +1640,28 @@ function sendInitialTracking(_0) {
|
|
|
1780
1640
|
];
|
|
1781
1641
|
case 2:
|
|
1782
1642
|
metricEvent = _state.sent();
|
|
1783
|
-
publishTracking(licenseKey, "metrics", {
|
|
1784
|
-
events: [
|
|
1785
|
-
metricEvent
|
|
1786
|
-
]
|
|
1787
|
-
});
|
|
1788
1643
|
return [
|
|
1789
|
-
|
|
1790
|
-
|
|
1644
|
+
4,
|
|
1645
|
+
ingestPlayerTracking(licenseKey, "metrics", {
|
|
1646
|
+
events: [
|
|
1647
|
+
metricEvent
|
|
1648
|
+
]
|
|
1649
|
+
})
|
|
1791
1650
|
];
|
|
1792
1651
|
case 3:
|
|
1652
|
+
_state.sent();
|
|
1653
|
+
return [
|
|
1654
|
+
3,
|
|
1655
|
+
5
|
|
1656
|
+
];
|
|
1657
|
+
case 4:
|
|
1793
1658
|
error = _state.sent();
|
|
1794
1659
|
console.error("[StormcloudVideoPlayer] Error sending initial tracking data:", error);
|
|
1795
1660
|
return [
|
|
1796
1661
|
3,
|
|
1797
|
-
|
|
1662
|
+
5
|
|
1798
1663
|
];
|
|
1799
|
-
case
|
|
1664
|
+
case 5:
|
|
1800
1665
|
return [
|
|
1801
1666
|
2
|
|
1802
1667
|
];
|
|
@@ -1819,9 +1684,9 @@ function sendHeartbeat(_0) {
|
|
|
1819
1684
|
case 1:
|
|
1820
1685
|
_state.trys.push([
|
|
1821
1686
|
1,
|
|
1822
|
-
|
|
1687
|
+
4,
|
|
1823
1688
|
,
|
|
1824
|
-
|
|
1689
|
+
5
|
|
1825
1690
|
]);
|
|
1826
1691
|
return [
|
|
1827
1692
|
4,
|
|
@@ -1829,19 +1694,28 @@ function sendHeartbeat(_0) {
|
|
|
1829
1694
|
];
|
|
1830
1695
|
case 2:
|
|
1831
1696
|
heartbeatData = _state.sent();
|
|
1832
|
-
publishTracking(licenseKey, "heartbeat", heartbeatData);
|
|
1833
1697
|
return [
|
|
1834
|
-
|
|
1835
|
-
|
|
1698
|
+
4,
|
|
1699
|
+
ingestPlayerTracking(licenseKey, "metrics", {
|
|
1700
|
+
events: [
|
|
1701
|
+
heartbeatData
|
|
1702
|
+
]
|
|
1703
|
+
})
|
|
1836
1704
|
];
|
|
1837
1705
|
case 3:
|
|
1706
|
+
_state.sent();
|
|
1707
|
+
return [
|
|
1708
|
+
3,
|
|
1709
|
+
5
|
|
1710
|
+
];
|
|
1711
|
+
case 4:
|
|
1838
1712
|
error = _state.sent();
|
|
1839
1713
|
console.error("[StormcloudVideoPlayer] Error sending heartbeat:", error);
|
|
1840
1714
|
return [
|
|
1841
1715
|
3,
|
|
1842
|
-
|
|
1716
|
+
5
|
|
1843
1717
|
];
|
|
1844
|
-
case
|
|
1718
|
+
case 5:
|
|
1845
1719
|
return [
|
|
1846
1720
|
2
|
|
1847
1721
|
];
|
|
@@ -1966,7 +1840,6 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
1966
1840
|
];
|
|
1967
1841
|
case 4:
|
|
1968
1842
|
data = _state.sent();
|
|
1969
|
-
this.applyMqttConfigFromResponse(data);
|
|
1970
1843
|
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;
|
|
1971
1844
|
if (imaPayload) {
|
|
1972
1845
|
decodedPayload = imaPayload;
|
|
@@ -2000,20 +1873,6 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
2000
1873
|
}).call(this);
|
|
2001
1874
|
}
|
|
2002
1875
|
},
|
|
2003
|
-
{
|
|
2004
|
-
key: "applyMqttConfigFromResponse",
|
|
2005
|
-
value: function applyMqttConfigFromResponse(data) {
|
|
2006
|
-
var _data_response;
|
|
2007
|
-
var mqttConfig2 = (_data_response = data.response) === null || _data_response === void 0 ? void 0 : _data_response.mqtt_config;
|
|
2008
|
-
if (!mqttConfig2 || (typeof mqttConfig2 === "undefined" ? "undefined" : _type_of(mqttConfig2)) !== "object") {
|
|
2009
|
-
return;
|
|
2010
|
-
}
|
|
2011
|
-
applyMQTTConfig(mqttConfig2);
|
|
2012
|
-
if (this.debug) {
|
|
2013
|
-
console.log("[StormcloudVideoPlayer] Applied MQTT config from /ads/web:", mqttConfig2);
|
|
2014
|
-
}
|
|
2015
|
-
}
|
|
2016
|
-
},
|
|
2017
1876
|
{
|
|
2018
1877
|
key: "fetchAndParseVmap",
|
|
2019
1878
|
value: function fetchAndParseVmap(vmapUrl) {
|
|
@@ -2310,6 +2169,18 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
2310
2169
|
};
|
|
2311
2170
|
}
|
|
2312
2171
|
},
|
|
2172
|
+
{
|
|
2173
|
+
key: "getPalDescriptionUrl",
|
|
2174
|
+
value: function getPalDescriptionUrl() {
|
|
2175
|
+
if (!this.apiVastTagUrl) return void 0;
|
|
2176
|
+
try {
|
|
2177
|
+
var params = new URL(this.apiVastTagUrl).searchParams;
|
|
2178
|
+
return params.get("description_url") || params.get("url") || void 0;
|
|
2179
|
+
} catch (unused) {
|
|
2180
|
+
return void 0;
|
|
2181
|
+
}
|
|
2182
|
+
}
|
|
2183
|
+
},
|
|
2313
2184
|
{
|
|
2314
2185
|
key: "generatePodVastUrl",
|
|
2315
2186
|
value: function generatePodVastUrl(baseUrl, podParams, adPlayer, palNonce, inAdBreak) {
|
|
@@ -2324,12 +2195,9 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
2324
2195
|
podMinDurationMs: podParams.minDurationMs,
|
|
2325
2196
|
podMaxDurationMs: podParams.maxDurationMs,
|
|
2326
2197
|
isCtv: envSignals.isCtv,
|
|
2327
|
-
contentUrl: envSignals.contentUrl,
|
|
2328
2198
|
pageUrl: !envSignals.isCtv && typeof window !== "undefined" ? toDevSafeUrl(window.location.href) : void 0,
|
|
2329
2199
|
adWillPlayMuted: adWillPlayMuted,
|
|
2330
2200
|
adWillAutoPlay: !!this.config.autoplay,
|
|
2331
|
-
appId: envSignals.appId,
|
|
2332
|
-
appName: envSignals.appName,
|
|
2333
2201
|
sessionId: envSignals.sessionId,
|
|
2334
2202
|
deviceId: envSignals.deviceId,
|
|
2335
2203
|
deviceIdType: envSignals.deviceIdType,
|