stormcloud-video-player 0.3.65 → 0.3.66

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/lib/index.d.cts CHANGED
@@ -2,6 +2,25 @@ import React, { CSSProperties, lazy as lazy$1 } from 'react';
2
2
  import * as csstype from 'csstype';
3
3
  import Hls from 'hls.js';
4
4
 
5
+ declare const MQTT_CA_CERT_FILE = "src/certs/emqxsl-ca.crt";
6
+ type MQTTConfig = {
7
+ enabled: boolean;
8
+ brokerAddress: string;
9
+ brokerPort: number;
10
+ wsPort: number;
11
+ username: string;
12
+ password: string;
13
+ topicPrefix: string;
14
+ qos: 0 | 1 | 2;
15
+ brokerUrl?: string;
16
+ };
17
+ declare const DEFAULT_MQTT_CONFIG: MQTTConfig;
18
+ declare const mqttConfig: MQTTConfig;
19
+ declare function applyMQTTConfig(overrides: Partial<MQTTConfig>): void;
20
+ declare function isMQTTEnabled(): boolean;
21
+ declare function buildMQTTBrokerUrl(): string;
22
+ declare function buildPlayerTopic(licenseKey: string, channel: "metrics" | "impressions" | "heartbeat"): string;
23
+
5
24
  type LateJoinPolicy = "play_remaining" | "skip_to_content";
6
25
  interface AdBreak {
7
26
  id?: string;
@@ -270,6 +289,7 @@ declare class StormcloudVideoPlayer {
270
289
  private initializeTracking;
271
290
  private sendHeartbeatIfNeeded;
272
291
  private isVmapEnabled;
292
+ private applyMqttConfigFromResponse;
273
293
  private fetchAdConfiguration;
274
294
  private fetchAndParseVmap;
275
295
  private parseVmapToBreaks;
@@ -4084,25 +4104,6 @@ declare function sendAdLoadedTracking(licenseKey: string | undefined, adLoadedIn
4084
4104
  declare function sendAdImpressionTracking(licenseKey: string | undefined, adImpressionInfo: AdImpressionInfo, context?: PlayerAnalyticsContext): Promise<void>;
4085
4105
  declare function sendHeartbeat(licenseKey?: string, context?: PlayerAnalyticsContext, flags?: PlayerMetricFlags): Promise<void>;
4086
4106
 
4087
- declare const MQTT_CA_CERT_FILE = "src/certs/emqxsl-ca.crt";
4088
- type MQTTConfig = {
4089
- enabled: boolean;
4090
- brokerAddress: string;
4091
- brokerPort: number;
4092
- wsPort: number;
4093
- username: string;
4094
- password: string;
4095
- topicPrefix: string;
4096
- qos: 0 | 1 | 2;
4097
- brokerUrl?: string;
4098
- };
4099
- declare const DEFAULT_MQTT_CONFIG: MQTTConfig;
4100
- declare const mqttConfig: MQTTConfig;
4101
- declare function applyMQTTConfig(overrides: Partial<MQTTConfig>): void;
4102
- declare function isMQTTEnabled(): boolean;
4103
- declare function buildMQTTBrokerUrl(): string;
4104
- declare function buildPlayerTopic(licenseKey: string, channel: "metrics" | "impressions" | "heartbeat"): string;
4105
-
4106
4107
  type MQTTStatus = "disconnected" | "connecting" | "connected" | "error";
4107
4108
  declare function getMQTTStatus(): MQTTStatus;
4108
4109
  declare function isMQTTConnected(): boolean;
package/lib/index.d.ts CHANGED
@@ -2,6 +2,25 @@ import React, { CSSProperties, lazy as lazy$1 } from 'react';
2
2
  import * as csstype from 'csstype';
3
3
  import Hls from 'hls.js';
4
4
 
5
+ declare const MQTT_CA_CERT_FILE = "src/certs/emqxsl-ca.crt";
6
+ type MQTTConfig = {
7
+ enabled: boolean;
8
+ brokerAddress: string;
9
+ brokerPort: number;
10
+ wsPort: number;
11
+ username: string;
12
+ password: string;
13
+ topicPrefix: string;
14
+ qos: 0 | 1 | 2;
15
+ brokerUrl?: string;
16
+ };
17
+ declare const DEFAULT_MQTT_CONFIG: MQTTConfig;
18
+ declare const mqttConfig: MQTTConfig;
19
+ declare function applyMQTTConfig(overrides: Partial<MQTTConfig>): void;
20
+ declare function isMQTTEnabled(): boolean;
21
+ declare function buildMQTTBrokerUrl(): string;
22
+ declare function buildPlayerTopic(licenseKey: string, channel: "metrics" | "impressions" | "heartbeat"): string;
23
+
5
24
  type LateJoinPolicy = "play_remaining" | "skip_to_content";
6
25
  interface AdBreak {
7
26
  id?: string;
@@ -270,6 +289,7 @@ declare class StormcloudVideoPlayer {
270
289
  private initializeTracking;
271
290
  private sendHeartbeatIfNeeded;
272
291
  private isVmapEnabled;
292
+ private applyMqttConfigFromResponse;
273
293
  private fetchAdConfiguration;
274
294
  private fetchAndParseVmap;
275
295
  private parseVmapToBreaks;
@@ -4084,25 +4104,6 @@ declare function sendAdLoadedTracking(licenseKey: string | undefined, adLoadedIn
4084
4104
  declare function sendAdImpressionTracking(licenseKey: string | undefined, adImpressionInfo: AdImpressionInfo, context?: PlayerAnalyticsContext): Promise<void>;
4085
4105
  declare function sendHeartbeat(licenseKey?: string, context?: PlayerAnalyticsContext, flags?: PlayerMetricFlags): Promise<void>;
4086
4106
 
4087
- declare const MQTT_CA_CERT_FILE = "src/certs/emqxsl-ca.crt";
4088
- type MQTTConfig = {
4089
- enabled: boolean;
4090
- brokerAddress: string;
4091
- brokerPort: number;
4092
- wsPort: number;
4093
- username: string;
4094
- password: string;
4095
- topicPrefix: string;
4096
- qos: 0 | 1 | 2;
4097
- brokerUrl?: string;
4098
- };
4099
- declare const DEFAULT_MQTT_CONFIG: MQTTConfig;
4100
- declare const mqttConfig: MQTTConfig;
4101
- declare function applyMQTTConfig(overrides: Partial<MQTTConfig>): void;
4102
- declare function isMQTTEnabled(): boolean;
4103
- declare function buildMQTTBrokerUrl(): string;
4104
- declare function buildPlayerTopic(licenseKey: string, channel: "metrics" | "impressions" | "heartbeat"): string;
4105
-
4106
4107
  type MQTTStatus = "disconnected" | "connecting" | "connected" | "error";
4107
4108
  declare function getMQTTStatus(): MQTTStatus;
4108
4109
  declare function isMQTTConnected(): boolean;
package/lib/index.js CHANGED
@@ -5442,6 +5442,20 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5442
5442
  return !!(this.config.isVmap && ((_this_config_vmapUrl = this.config.vmapUrl) === null || _this_config_vmapUrl === void 0 ? void 0 : _this_config_vmapUrl.trim()));
5443
5443
  }
5444
5444
  },
5445
+ {
5446
+ key: "applyMqttConfigFromResponse",
5447
+ value: function applyMqttConfigFromResponse(data) {
5448
+ var _data_response;
5449
+ var mqttConfig2 = (_data_response = data.response) === null || _data_response === void 0 ? void 0 : _data_response.mqtt_config;
5450
+ if (!mqttConfig2 || (typeof mqttConfig2 === "undefined" ? "undefined" : _type_of(mqttConfig2)) !== "object") {
5451
+ return;
5452
+ }
5453
+ applyMQTTConfig(mqttConfig2);
5454
+ if (this.config.debugAdTiming) {
5455
+ console.log("[StormcloudVideoPlayer] Applied MQTT config from /ads/web:", mqttConfig2);
5456
+ }
5457
+ }
5458
+ },
5445
5459
  {
5446
5460
  key: "fetchAdConfiguration",
5447
5461
  value: function fetchAdConfiguration() {
@@ -5528,6 +5542,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5528
5542
  ];
5529
5543
  case 4:
5530
5544
  data = _state.sent();
5545
+ this.applyMqttConfigFromResponse(data);
5531
5546
  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;
5532
5547
  if (imaPayload) {
5533
5548
  this.apiVastTagUrl = decodeURIComponent(imaPayload);