stormcloud-video-player 0.8.3 → 0.8.4
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 +3 -1
- package/lib/index.cjs +353 -203
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +36 -2
- package/lib/index.d.ts +36 -2
- package/lib/index.js +294 -204
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +262 -202
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +5 -2
- package/lib/players/HlsPlayer.cjs +262 -202
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.d.cts +1 -1
- package/lib/players/index.cjs +262 -202
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.d.cts +1 -1
- package/lib/{types-DWVgdqF-.d.cts → types-BmF_60m2.d.cts} +1 -0
- package/lib/ui/StormcloudVideoPlayer.cjs +267 -203
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.d.cts +1 -1
- package/lib/utils/mqttClient.cjs +245 -0
- package/lib/utils/mqttClient.cjs.map +1 -0
- package/lib/utils/mqttClient.d.cts +13 -0
- package/lib/utils/mqttConfig.cjs +141 -0
- package/lib/utils/mqttConfig.cjs.map +1 -0
- package/lib/utils/mqttConfig.d.cts +20 -0
- package/lib/utils/tracking.cjs +182 -170
- package/lib/utils/tracking.cjs.map +1 -1
- package/lib/utils/tracking.d.cts +1 -1
- package/package.json +3 -1
- package/src/certs/emqxsl-ca.crt +22 -0
package/lib/utils/tracking.cjs
CHANGED
|
@@ -159,9 +159,11 @@ function _ts_generator(thisArg, body) {
|
|
|
159
159
|
};
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
|
+
var __create = Object.create;
|
|
162
163
|
var __defProp = Object.defineProperty;
|
|
163
164
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
164
165
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
166
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
165
167
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
166
168
|
var __export = function __export(target, all) {
|
|
167
169
|
for(var name in all)__defProp(target, name, {
|
|
@@ -200,6 +202,16 @@ var __copyProps = function __copyProps(to, from, except, desc) {
|
|
|
200
202
|
}
|
|
201
203
|
return to;
|
|
202
204
|
};
|
|
205
|
+
var __toESM = function __toESM(mod, isNodeMode, target) {
|
|
206
|
+
return target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(// If the importer is in node compatibility mode or this is not an ESM
|
|
207
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
208
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
209
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
210
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
211
|
+
value: mod,
|
|
212
|
+
enumerable: true
|
|
213
|
+
}) : target, mod);
|
|
214
|
+
};
|
|
203
215
|
var __toCommonJS = function __toCommonJS(mod) {
|
|
204
216
|
return __copyProps(__defProp({}, "__esModule", {
|
|
205
217
|
value: true
|
|
@@ -231,6 +243,100 @@ __export(tracking_exports, {
|
|
|
231
243
|
}
|
|
232
244
|
});
|
|
233
245
|
module.exports = __toCommonJS(tracking_exports);
|
|
246
|
+
// src/utils/mqttConfig.ts
|
|
247
|
+
var DEFAULT_MQTT_CONFIG = {
|
|
248
|
+
enabled: true,
|
|
249
|
+
brokerAddress: "vecbae77.ala.us-east-1.emqxsl.com",
|
|
250
|
+
brokerPort: 8883,
|
|
251
|
+
wsPort: 8084,
|
|
252
|
+
username: "for-sonifi",
|
|
253
|
+
password: "sonifi-mqtt",
|
|
254
|
+
topicPrefix: "adstorm/players",
|
|
255
|
+
qos: 1
|
|
256
|
+
};
|
|
257
|
+
var mqttConfig = _object_spread({}, DEFAULT_MQTT_CONFIG);
|
|
258
|
+
function isMQTTEnabled() {
|
|
259
|
+
return mqttConfig.enabled;
|
|
260
|
+
}
|
|
261
|
+
function buildMQTTBrokerUrl() {
|
|
262
|
+
if (mqttConfig.brokerUrl) return mqttConfig.brokerUrl;
|
|
263
|
+
return "wss://".concat(mqttConfig.brokerAddress, ":").concat(mqttConfig.wsPort, "/mqtt");
|
|
264
|
+
}
|
|
265
|
+
function buildPlayerTopic(licenseKey, channel) {
|
|
266
|
+
return "".concat(mqttConfig.topicPrefix, "/").concat(licenseKey, "/").concat(channel);
|
|
267
|
+
}
|
|
268
|
+
// src/utils/mqttClient.ts
|
|
269
|
+
var import_mqtt = __toESM(require("mqtt"), 1);
|
|
270
|
+
var LOG = "[StormcloudVideoPlayer][MQTT]";
|
|
271
|
+
var client = null;
|
|
272
|
+
var status = "disconnected";
|
|
273
|
+
function initMQTTClient() {
|
|
274
|
+
if (client || !isMQTTEnabled()) return;
|
|
275
|
+
var url = buildMQTTBrokerUrl();
|
|
276
|
+
status = "connecting";
|
|
277
|
+
var clientId = "stormcloud-vp-".concat(Math.random().toString(36).slice(2, 9));
|
|
278
|
+
try {
|
|
279
|
+
client = import_mqtt.default.connect(url, {
|
|
280
|
+
clientId: clientId,
|
|
281
|
+
username: mqttConfig.username,
|
|
282
|
+
password: mqttConfig.password,
|
|
283
|
+
keepalive: 60,
|
|
284
|
+
clean: true,
|
|
285
|
+
reconnectPeriod: 5e3,
|
|
286
|
+
connectTimeout: 1e4,
|
|
287
|
+
queueQoSZero: false
|
|
288
|
+
});
|
|
289
|
+
} catch (err) {
|
|
290
|
+
status = "error";
|
|
291
|
+
console.warn("".concat(LOG, " connect() threw:"), err);
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
client.on("connect", function() {
|
|
295
|
+
status = "connected";
|
|
296
|
+
console.info("".concat(LOG, " connected to ").concat(url));
|
|
297
|
+
});
|
|
298
|
+
client.on("reconnect", function() {
|
|
299
|
+
status = "connecting";
|
|
300
|
+
console.info("".concat(LOG, " reconnecting…"));
|
|
301
|
+
});
|
|
302
|
+
client.on("offline", function() {
|
|
303
|
+
status = "disconnected";
|
|
304
|
+
console.warn("".concat(LOG, " offline"));
|
|
305
|
+
});
|
|
306
|
+
client.on("error", function(err) {
|
|
307
|
+
status = "error";
|
|
308
|
+
console.warn("".concat(LOG, " error:"), err.message);
|
|
309
|
+
});
|
|
310
|
+
client.on("close", function() {
|
|
311
|
+
if (status === "connected") {
|
|
312
|
+
status = "disconnected";
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
function ensureMQTTClient() {
|
|
317
|
+
if (isMQTTEnabled() && !client) {
|
|
318
|
+
initMQTTClient();
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
function publishMQTT(topic, payload) {
|
|
322
|
+
if (!isMQTTEnabled()) {
|
|
323
|
+
return false;
|
|
324
|
+
}
|
|
325
|
+
ensureMQTTClient();
|
|
326
|
+
if (!client) {
|
|
327
|
+
return false;
|
|
328
|
+
}
|
|
329
|
+
try {
|
|
330
|
+
client.publish(topic, JSON.stringify(payload), {
|
|
331
|
+
qos: mqttConfig.qos
|
|
332
|
+
});
|
|
333
|
+
return true;
|
|
334
|
+
} catch (err) {
|
|
335
|
+
console.warn("".concat(LOG, " publish failed on ").concat(topic, ":"), err);
|
|
336
|
+
return false;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
// src/utils/tracking.ts
|
|
234
340
|
var cachedBrowserId = null;
|
|
235
341
|
function getClientInfo() {
|
|
236
342
|
var _screen, _screen1, _screen2, _screen3, _screen_orientation, _screen4, _screen5, _window, _window1, _window_screen_orientation, _window_screen, _navigator_languages;
|
|
@@ -376,7 +482,7 @@ function getClientInfo() {
|
|
|
376
482
|
}
|
|
377
483
|
function getBrowserID(clientInfo) {
|
|
378
484
|
return _async_to_generator(function() {
|
|
379
|
-
var fingerprintString, encodedData, utf8, buffer, i, hashBuffer,
|
|
485
|
+
var _crypto_subtle, fingerprintString, encodedData, utf8, buffer, i, hashBuffer, hashHex, unused, hash, i1, char, fallbackHash, timestamp, random;
|
|
380
486
|
return _ts_generator(this, function(_state) {
|
|
381
487
|
switch(_state.label){
|
|
382
488
|
case 0:
|
|
@@ -387,7 +493,7 @@ function getBrowserID(clientInfo) {
|
|
|
387
493
|
];
|
|
388
494
|
}
|
|
389
495
|
fingerprintString = JSON.stringify(clientInfo);
|
|
390
|
-
if (!(typeof crypto !== "undefined" && crypto.subtle
|
|
496
|
+
if (!(typeof crypto !== "undefined" && ((_crypto_subtle = crypto.subtle) === null || _crypto_subtle === void 0 ? void 0 : _crypto_subtle.digest))) return [
|
|
391
497
|
3,
|
|
392
498
|
5
|
|
393
499
|
];
|
|
@@ -425,8 +531,7 @@ function getBrowserID(clientInfo) {
|
|
|
425
531
|
];
|
|
426
532
|
case 3:
|
|
427
533
|
hashBuffer = _state.sent();
|
|
428
|
-
|
|
429
|
-
hashHex = hashArray.map(function(b) {
|
|
534
|
+
hashHex = Array.from(new Uint8Array(hashBuffer)).map(function(b) {
|
|
430
535
|
return b.toString(16).padStart(2, "0");
|
|
431
536
|
}).join("");
|
|
432
537
|
cachedBrowserId = hashHex;
|
|
@@ -435,8 +540,8 @@ function getBrowserID(clientInfo) {
|
|
|
435
540
|
hashHex
|
|
436
541
|
];
|
|
437
542
|
case 4:
|
|
438
|
-
|
|
439
|
-
console.warn("[StormcloudVideoPlayer] crypto.subtle
|
|
543
|
+
unused = _state.sent();
|
|
544
|
+
console.warn("[StormcloudVideoPlayer] crypto.subtle not supported, using fallback hash");
|
|
440
545
|
return [
|
|
441
546
|
3,
|
|
442
547
|
5
|
|
@@ -460,177 +565,91 @@ function getBrowserID(clientInfo) {
|
|
|
460
565
|
});
|
|
461
566
|
})();
|
|
462
567
|
}
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
var HEARTBEAT_URL = "".concat(PLAYER_TRACKING_BASE_URL, "/heartbeat");
|
|
466
|
-
var IMPRESSIONS_URL = "".concat(PLAYER_TRACKING_BASE_URL, "/impressions/ingest");
|
|
467
|
-
function buildHeaders(licenseKey) {
|
|
468
|
-
var headers = {
|
|
469
|
-
"Content-Type": "application/json"
|
|
470
|
-
};
|
|
471
|
-
if (licenseKey) {
|
|
472
|
-
headers["Authorization"] = "Bearer ".concat(licenseKey);
|
|
473
|
-
}
|
|
474
|
-
return headers;
|
|
475
|
-
}
|
|
476
|
-
function sendTrackRequest(licenseKey, body) {
|
|
477
|
-
return _async_to_generator(function() {
|
|
478
|
-
var response;
|
|
479
|
-
return _ts_generator(this, function(_state) {
|
|
480
|
-
switch(_state.label){
|
|
481
|
-
case 0:
|
|
482
|
-
return [
|
|
483
|
-
4,
|
|
484
|
-
fetch(TRACK_URL, {
|
|
485
|
-
method: "POST",
|
|
486
|
-
headers: buildHeaders(licenseKey),
|
|
487
|
-
body: JSON.stringify(body)
|
|
488
|
-
})
|
|
489
|
-
];
|
|
490
|
-
case 1:
|
|
491
|
-
response = _state.sent();
|
|
492
|
-
if (!response.ok) {
|
|
493
|
-
throw new Error("HTTP error! status: ".concat(response.status));
|
|
494
|
-
}
|
|
495
|
-
return [
|
|
496
|
-
4,
|
|
497
|
-
response.json()
|
|
498
|
-
];
|
|
499
|
-
case 2:
|
|
500
|
-
_state.sent();
|
|
501
|
-
return [
|
|
502
|
-
2
|
|
503
|
-
];
|
|
504
|
-
}
|
|
505
|
-
});
|
|
506
|
-
})();
|
|
568
|
+
function canPublish(licenseKey) {
|
|
569
|
+
return Boolean(isMQTTEnabled() && licenseKey);
|
|
507
570
|
}
|
|
508
|
-
function
|
|
571
|
+
function buildPlayerMetricEvent() {
|
|
509
572
|
return _async_to_generator(function() {
|
|
510
|
-
var
|
|
511
|
-
return _ts_generator(this, function(_state) {
|
|
512
|
-
switch(_state.label){
|
|
513
|
-
case 0:
|
|
514
|
-
return [
|
|
515
|
-
4,
|
|
516
|
-
fetch(url, {
|
|
517
|
-
method: "POST",
|
|
518
|
-
headers: buildHeaders(licenseKey),
|
|
519
|
-
body: JSON.stringify(body)
|
|
520
|
-
})
|
|
521
|
-
];
|
|
522
|
-
case 1:
|
|
523
|
-
response = _state.sent();
|
|
524
|
-
if (!response.ok) {
|
|
525
|
-
throw new Error("HTTP error! status: ".concat(response.status));
|
|
526
|
-
}
|
|
527
|
-
return [
|
|
528
|
-
4,
|
|
529
|
-
response.json()
|
|
530
|
-
];
|
|
531
|
-
case 2:
|
|
532
|
-
_state.sent();
|
|
533
|
-
return [
|
|
534
|
-
2
|
|
535
|
-
];
|
|
536
|
-
}
|
|
537
|
-
});
|
|
538
|
-
})();
|
|
539
|
-
}
|
|
540
|
-
function buildPlayerMetricEvent(_0) {
|
|
541
|
-
return _async_to_generator(function(licenseKey) {
|
|
542
|
-
var context, flags, _flags_captureAt, clientInfo, browserId, captureAt;
|
|
573
|
+
var context, flags, _flags_captureAt, _flags_adLoaded, _flags_adDetect, clientInfo, playerId, captureAt;
|
|
543
574
|
var _arguments = arguments;
|
|
544
575
|
return _ts_generator(this, function(_state) {
|
|
545
576
|
switch(_state.label){
|
|
546
577
|
case 0:
|
|
547
|
-
context = _arguments.length >
|
|
578
|
+
context = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {}, flags = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : {};
|
|
548
579
|
clientInfo = getClientInfo();
|
|
549
580
|
return [
|
|
550
581
|
4,
|
|
551
582
|
getBrowserID(clientInfo)
|
|
552
583
|
];
|
|
553
584
|
case 1:
|
|
554
|
-
|
|
585
|
+
playerId = _state.sent();
|
|
555
586
|
captureAt = (_flags_captureAt = flags.captureAt) !== null && _flags_captureAt !== void 0 ? _flags_captureAt : /* @__PURE__ */ new Date().toISOString();
|
|
556
587
|
return [
|
|
557
588
|
2,
|
|
558
|
-
{
|
|
559
|
-
player_id:
|
|
560
|
-
browserId: browserId,
|
|
589
|
+
_object_spread({
|
|
590
|
+
player_id: playerId,
|
|
561
591
|
device_type: clientInfo.deviceType,
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
timestamp: captureAt
|
|
570
|
-
}
|
|
592
|
+
os: clientInfo.os.toLowerCase(),
|
|
593
|
+
ad_loaded: (_flags_adLoaded = flags.adLoaded) !== null && _flags_adLoaded !== void 0 ? _flags_adLoaded : false,
|
|
594
|
+
ad_detect: (_flags_adDetect = flags.adDetect) !== null && _flags_adDetect !== void 0 ? _flags_adDetect : false,
|
|
595
|
+
capture_at: captureAt
|
|
596
|
+
}, context.inputStreamType ? {
|
|
597
|
+
input_stream_type: context.inputStreamType
|
|
598
|
+
} : {})
|
|
571
599
|
];
|
|
572
600
|
}
|
|
573
601
|
});
|
|
574
602
|
}).apply(this, arguments);
|
|
575
603
|
}
|
|
604
|
+
function publishTracking(licenseKey, channel, body) {
|
|
605
|
+
ensureMQTTClient();
|
|
606
|
+
publishMQTT(buildPlayerTopic(licenseKey, channel), body);
|
|
607
|
+
}
|
|
576
608
|
function sendInitialTracking(_0) {
|
|
577
609
|
return _async_to_generator(function(licenseKey) {
|
|
578
|
-
var context,
|
|
610
|
+
var context, metricEvent, error;
|
|
579
611
|
var _arguments = arguments;
|
|
580
612
|
return _ts_generator(this, function(_state) {
|
|
581
613
|
switch(_state.label){
|
|
582
614
|
case 0:
|
|
583
615
|
context = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : {};
|
|
616
|
+
if (!canPublish(licenseKey)) return [
|
|
617
|
+
2
|
|
618
|
+
];
|
|
584
619
|
_state.label = 1;
|
|
585
620
|
case 1:
|
|
586
621
|
_state.trys.push([
|
|
587
622
|
1,
|
|
588
|
-
|
|
623
|
+
3,
|
|
589
624
|
,
|
|
590
|
-
|
|
625
|
+
4
|
|
591
626
|
]);
|
|
592
|
-
clientInfo = getClientInfo();
|
|
593
627
|
return [
|
|
594
628
|
4,
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
browserId = _state.sent();
|
|
599
|
-
trackingData = _object_spread({
|
|
600
|
-
browserId: browserId
|
|
601
|
-
}, clientInfo);
|
|
602
|
-
return [
|
|
603
|
-
4,
|
|
604
|
-
sendTrackRequest(licenseKey, {
|
|
605
|
-
events: [
|
|
606
|
-
{
|
|
607
|
-
player_id: browserId,
|
|
608
|
-
device_type: clientInfo.deviceType,
|
|
609
|
-
input_stream_type: context.inputStreamType,
|
|
610
|
-
os: clientInfo.os,
|
|
611
|
-
ad_loaded: false,
|
|
612
|
-
ad_detect: false,
|
|
613
|
-
license_key: licenseKey,
|
|
614
|
-
capture_at: /* @__PURE__ */ new Date().toISOString()
|
|
615
|
-
}
|
|
616
|
-
],
|
|
617
|
-
trackingData: trackingData
|
|
629
|
+
buildPlayerMetricEvent(context, {
|
|
630
|
+
adLoaded: false,
|
|
631
|
+
adDetect: false
|
|
618
632
|
})
|
|
619
633
|
];
|
|
620
|
-
case
|
|
621
|
-
_state.sent();
|
|
634
|
+
case 2:
|
|
635
|
+
metricEvent = _state.sent();
|
|
636
|
+
publishTracking(licenseKey, "metrics", {
|
|
637
|
+
events: [
|
|
638
|
+
metricEvent
|
|
639
|
+
]
|
|
640
|
+
});
|
|
622
641
|
return [
|
|
623
642
|
3,
|
|
624
|
-
|
|
643
|
+
4
|
|
625
644
|
];
|
|
626
|
-
case
|
|
645
|
+
case 3:
|
|
627
646
|
error = _state.sent();
|
|
628
647
|
console.error("[StormcloudVideoPlayer] Error sending initial tracking data:", error);
|
|
629
648
|
return [
|
|
630
649
|
3,
|
|
631
|
-
|
|
650
|
+
4
|
|
632
651
|
];
|
|
633
|
-
case
|
|
652
|
+
case 4:
|
|
634
653
|
return [
|
|
635
654
|
2
|
|
636
655
|
];
|
|
@@ -734,53 +753,48 @@ function sendAdImpressionTracking(_0, _1) {
|
|
|
734
753
|
switch(_state.label){
|
|
735
754
|
case 0:
|
|
736
755
|
context = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {};
|
|
756
|
+
if (!canPublish(licenseKey)) return [
|
|
757
|
+
2
|
|
758
|
+
];
|
|
737
759
|
_state.label = 1;
|
|
738
760
|
case 1:
|
|
739
761
|
_state.trys.push([
|
|
740
762
|
1,
|
|
741
|
-
|
|
763
|
+
3,
|
|
742
764
|
,
|
|
743
|
-
|
|
765
|
+
4
|
|
744
766
|
]);
|
|
745
767
|
return [
|
|
746
768
|
4,
|
|
747
|
-
buildPlayerMetricEvent(
|
|
769
|
+
buildPlayerMetricEvent(context, {
|
|
748
770
|
captureAt: adImpressionInfo.timestamp
|
|
749
771
|
})
|
|
750
772
|
];
|
|
751
773
|
case 2:
|
|
752
774
|
metricEvent = _state.sent();
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
capture_at: adImpressionInfo.timestamp
|
|
765
|
-
}
|
|
766
|
-
]
|
|
767
|
-
})
|
|
768
|
-
])
|
|
769
|
-
];
|
|
770
|
-
case 3:
|
|
771
|
-
_state.sent();
|
|
775
|
+
publishTracking(licenseKey, "heartbeat", metricEvent);
|
|
776
|
+
publishTracking(licenseKey, "impressions", {
|
|
777
|
+
events: [
|
|
778
|
+
{
|
|
779
|
+
player_id: metricEvent.player_id,
|
|
780
|
+
ad_played_count: 1,
|
|
781
|
+
ad_url: adImpressionInfo.adUrl,
|
|
782
|
+
capture_at: adImpressionInfo.timestamp
|
|
783
|
+
}
|
|
784
|
+
]
|
|
785
|
+
});
|
|
772
786
|
return [
|
|
773
787
|
3,
|
|
774
|
-
|
|
788
|
+
4
|
|
775
789
|
];
|
|
776
|
-
case
|
|
790
|
+
case 3:
|
|
777
791
|
error = _state.sent();
|
|
778
792
|
console.error("[StormcloudVideoPlayer] Error sending ad impression tracking:", error);
|
|
779
793
|
return [
|
|
780
794
|
3,
|
|
781
|
-
|
|
795
|
+
4
|
|
782
796
|
];
|
|
783
|
-
case
|
|
797
|
+
case 4:
|
|
784
798
|
return [
|
|
785
799
|
2
|
|
786
800
|
];
|
|
@@ -796,38 +810,36 @@ function sendHeartbeat(_0) {
|
|
|
796
810
|
switch(_state.label){
|
|
797
811
|
case 0:
|
|
798
812
|
context = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : {}, flags = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {};
|
|
813
|
+
if (!canPublish(licenseKey)) return [
|
|
814
|
+
2
|
|
815
|
+
];
|
|
799
816
|
_state.label = 1;
|
|
800
817
|
case 1:
|
|
801
818
|
_state.trys.push([
|
|
802
819
|
1,
|
|
803
|
-
|
|
820
|
+
3,
|
|
804
821
|
,
|
|
805
|
-
|
|
822
|
+
4
|
|
806
823
|
]);
|
|
807
824
|
return [
|
|
808
825
|
4,
|
|
809
|
-
buildPlayerMetricEvent(
|
|
826
|
+
buildPlayerMetricEvent(context, flags)
|
|
810
827
|
];
|
|
811
828
|
case 2:
|
|
812
829
|
heartbeatData = _state.sent();
|
|
813
|
-
|
|
814
|
-
4,
|
|
815
|
-
postJson(HEARTBEAT_URL, licenseKey, heartbeatData)
|
|
816
|
-
];
|
|
817
|
-
case 3:
|
|
818
|
-
_state.sent();
|
|
830
|
+
publishTracking(licenseKey, "heartbeat", heartbeatData);
|
|
819
831
|
return [
|
|
820
832
|
3,
|
|
821
|
-
|
|
833
|
+
4
|
|
822
834
|
];
|
|
823
|
-
case
|
|
835
|
+
case 3:
|
|
824
836
|
error = _state.sent();
|
|
825
837
|
console.error("[StormcloudVideoPlayer] Error sending heartbeat:", error);
|
|
826
838
|
return [
|
|
827
839
|
3,
|
|
828
|
-
|
|
840
|
+
4
|
|
829
841
|
];
|
|
830
|
-
case
|
|
842
|
+
case 4:
|
|
831
843
|
return [
|
|
832
844
|
2
|
|
833
845
|
];
|