stormcloud-video-player 0.8.35 → 0.8.36

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;
@@ -3944,25 +3963,6 @@ declare function sendAdLoadedTracking(licenseKey: string | undefined, adLoadedIn
3944
3963
  declare function sendAdImpressionTracking(licenseKey: string | undefined, adImpressionInfo: AdImpressionInfo, context?: PlayerAnalyticsContext): Promise<void>;
3945
3964
  declare function sendHeartbeat(licenseKey?: string, context?: PlayerAnalyticsContext, flags?: PlayerMetricFlags): Promise<void>;
3946
3965
 
3947
- declare const MQTT_CA_CERT_FILE = "src/certs/emqxsl-ca.crt";
3948
- type MQTTConfig = {
3949
- enabled: boolean;
3950
- brokerAddress: string;
3951
- brokerPort: number;
3952
- wsPort: number;
3953
- username: string;
3954
- password: string;
3955
- topicPrefix: string;
3956
- qos: 0 | 1 | 2;
3957
- brokerUrl?: string;
3958
- };
3959
- declare const DEFAULT_MQTT_CONFIG: MQTTConfig;
3960
- declare const mqttConfig: MQTTConfig;
3961
- declare function applyMQTTConfig(overrides: Partial<MQTTConfig>): void;
3962
- declare function isMQTTEnabled(): boolean;
3963
- declare function buildMQTTBrokerUrl(): string;
3964
- declare function buildPlayerTopic(licenseKey: string, channel: "metrics" | "impressions" | "heartbeat"): string;
3965
-
3966
3966
  type MQTTStatus = "disconnected" | "connecting" | "connected" | "error";
3967
3967
  declare function getMQTTStatus(): MQTTStatus;
3968
3968
  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;
@@ -3944,25 +3963,6 @@ declare function sendAdLoadedTracking(licenseKey: string | undefined, adLoadedIn
3944
3963
  declare function sendAdImpressionTracking(licenseKey: string | undefined, adImpressionInfo: AdImpressionInfo, context?: PlayerAnalyticsContext): Promise<void>;
3945
3964
  declare function sendHeartbeat(licenseKey?: string, context?: PlayerAnalyticsContext, flags?: PlayerMetricFlags): Promise<void>;
3946
3965
 
3947
- declare const MQTT_CA_CERT_FILE = "src/certs/emqxsl-ca.crt";
3948
- type MQTTConfig = {
3949
- enabled: boolean;
3950
- brokerAddress: string;
3951
- brokerPort: number;
3952
- wsPort: number;
3953
- username: string;
3954
- password: string;
3955
- topicPrefix: string;
3956
- qos: 0 | 1 | 2;
3957
- brokerUrl?: string;
3958
- };
3959
- declare const DEFAULT_MQTT_CONFIG: MQTTConfig;
3960
- declare const mqttConfig: MQTTConfig;
3961
- declare function applyMQTTConfig(overrides: Partial<MQTTConfig>): void;
3962
- declare function isMQTTEnabled(): boolean;
3963
- declare function buildMQTTBrokerUrl(): string;
3964
- declare function buildPlayerTopic(licenseKey: string, channel: "metrics" | "impressions" | "heartbeat"): string;
3965
-
3966
3966
  type MQTTStatus = "disconnected" | "connecting" | "connected" | "error";
3967
3967
  declare function getMQTTStatus(): MQTTStatus;
3968
3968
  declare function isMQTTConnected(): boolean;
package/lib/index.js CHANGED
@@ -5099,6 +5099,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
5099
5099
  ];
5100
5100
  case 4:
5101
5101
  data = _state.sent();
5102
+ this.applyMqttConfigFromResponse(data);
5102
5103
  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;
5103
5104
  if (imaPayload) {
5104
5105
  decodedPayload = imaPayload;
@@ -5132,6 +5133,20 @@ var AdConfigManager = /*#__PURE__*/ function() {
5132
5133
  }).call(this);
5133
5134
  }
5134
5135
  },
5136
+ {
5137
+ key: "applyMqttConfigFromResponse",
5138
+ value: function applyMqttConfigFromResponse(data) {
5139
+ var _data_response;
5140
+ var mqttConfig2 = (_data_response = data.response) === null || _data_response === void 0 ? void 0 : _data_response.mqtt_config;
5141
+ if (!mqttConfig2 || (typeof mqttConfig2 === "undefined" ? "undefined" : _type_of(mqttConfig2)) !== "object") {
5142
+ return;
5143
+ }
5144
+ applyMQTTConfig(mqttConfig2);
5145
+ if (this.debug) {
5146
+ console.log("[StormcloudVideoPlayer] Applied MQTT config from /ads/web:", mqttConfig2);
5147
+ }
5148
+ }
5149
+ },
5135
5150
  {
5136
5151
  key: "fetchAndParseVmap",
5137
5152
  value: function fetchAndParseVmap(vmapUrl) {