stormcloud-video-player 0.7.50 → 0.7.52
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 +407 -158
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +73 -3
- package/lib/index.d.ts +73 -3
- package/lib/index.js +336 -159
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +246 -156
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +3 -1
- package/lib/players/HlsPlayer.cjs +246 -156
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.d.cts +2 -1
- package/lib/players/index.cjs +246 -156
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/adstormPlayer.d.cts +2 -1
- package/lib/{types-CIHDHY7A.d.cts → types-Dobqa8vR.d.cts} +8 -1
- package/lib/ui/OverlayRenderer.cjs +2 -3
- package/lib/ui/OverlayRenderer.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +286 -163
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.d.cts +2 -1
- package/lib/utils/mqttClient.cjs +247 -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 +237 -192
- package/lib/utils/tracking.cjs.map +1 -1
- package/lib/utils/tracking.d.cts +12 -6
- package/package.json +2 -1
|
@@ -1715,6 +1715,116 @@ function createAdStormPlayer(contentVideo, options) {
|
|
|
1715
1715
|
}
|
|
1716
1716
|
};
|
|
1717
1717
|
}
|
|
1718
|
+
// src/utils/mqttClient.ts
|
|
1719
|
+
var import_mqtt = __toESM(require("mqtt"), 1);
|
|
1720
|
+
// src/utils/mqttConfig.ts
|
|
1721
|
+
var DEFAULT_MQTT_CONFIG = {
|
|
1722
|
+
enabled: true,
|
|
1723
|
+
brokerAddress: "vecbae77.ala.us-east-1.emqxsl.com",
|
|
1724
|
+
brokerPort: 8883,
|
|
1725
|
+
wsPort: 8084,
|
|
1726
|
+
username: "for-sonifi",
|
|
1727
|
+
password: "sonifi-mqtt",
|
|
1728
|
+
topicPrefix: "adstorm/players",
|
|
1729
|
+
qos: 1
|
|
1730
|
+
};
|
|
1731
|
+
var mqttConfig = _object_spread({}, DEFAULT_MQTT_CONFIG);
|
|
1732
|
+
function applyMQTTConfig(overrides) {
|
|
1733
|
+
Object.assign(mqttConfig, overrides);
|
|
1734
|
+
}
|
|
1735
|
+
function isMQTTEnabled() {
|
|
1736
|
+
return mqttConfig.enabled;
|
|
1737
|
+
}
|
|
1738
|
+
function buildMQTTBrokerUrl() {
|
|
1739
|
+
if (mqttConfig.brokerUrl) return mqttConfig.brokerUrl;
|
|
1740
|
+
return "wss://".concat(mqttConfig.brokerAddress, ":").concat(mqttConfig.wsPort, "/mqtt");
|
|
1741
|
+
}
|
|
1742
|
+
function buildPlayerTopic(licenseKey, channel) {
|
|
1743
|
+
return "".concat(mqttConfig.topicPrefix, "/").concat(licenseKey, "/").concat(channel);
|
|
1744
|
+
}
|
|
1745
|
+
// src/utils/mqttClient.ts
|
|
1746
|
+
var LOG = "[StormcloudVideoPlayer][MQTT]";
|
|
1747
|
+
var client = null;
|
|
1748
|
+
var status = "disconnected";
|
|
1749
|
+
function configureMQTT(overrides) {
|
|
1750
|
+
applyMQTTConfig(overrides);
|
|
1751
|
+
disconnectMQTT();
|
|
1752
|
+
}
|
|
1753
|
+
function initMQTTClient() {
|
|
1754
|
+
if (client || !isMQTTEnabled()) return;
|
|
1755
|
+
var url = buildMQTTBrokerUrl();
|
|
1756
|
+
status = "connecting";
|
|
1757
|
+
var clientId = "stormcloud-vp-".concat(Math.random().toString(36).slice(2, 9));
|
|
1758
|
+
try {
|
|
1759
|
+
client = import_mqtt.default.connect(url, {
|
|
1760
|
+
clientId: clientId,
|
|
1761
|
+
username: mqttConfig.username,
|
|
1762
|
+
password: mqttConfig.password,
|
|
1763
|
+
keepalive: 60,
|
|
1764
|
+
clean: true,
|
|
1765
|
+
reconnectPeriod: 5e3,
|
|
1766
|
+
connectTimeout: 1e4,
|
|
1767
|
+
queueQoSZero: false
|
|
1768
|
+
});
|
|
1769
|
+
} catch (err) {
|
|
1770
|
+
status = "error";
|
|
1771
|
+
console.warn("".concat(LOG, " connect() threw:"), err);
|
|
1772
|
+
return;
|
|
1773
|
+
}
|
|
1774
|
+
client.on("connect", function() {
|
|
1775
|
+
status = "connected";
|
|
1776
|
+
console.info("".concat(LOG, " connected to ").concat(url));
|
|
1777
|
+
});
|
|
1778
|
+
client.on("reconnect", function() {
|
|
1779
|
+
status = "connecting";
|
|
1780
|
+
console.info("".concat(LOG, " reconnecting..."));
|
|
1781
|
+
});
|
|
1782
|
+
client.on("offline", function() {
|
|
1783
|
+
if (status !== "error") {
|
|
1784
|
+
status = "disconnected";
|
|
1785
|
+
}
|
|
1786
|
+
console.warn("".concat(LOG, " offline"));
|
|
1787
|
+
});
|
|
1788
|
+
client.on("error", function(err) {
|
|
1789
|
+
status = "error";
|
|
1790
|
+
console.warn("".concat(LOG, " error:"), err.message);
|
|
1791
|
+
});
|
|
1792
|
+
client.on("close", function() {
|
|
1793
|
+
if (status === "connected" || status === "connecting") {
|
|
1794
|
+
status = "disconnected";
|
|
1795
|
+
}
|
|
1796
|
+
});
|
|
1797
|
+
}
|
|
1798
|
+
function ensureMQTTClient() {
|
|
1799
|
+
if (isMQTTEnabled() && !client) {
|
|
1800
|
+
initMQTTClient();
|
|
1801
|
+
}
|
|
1802
|
+
}
|
|
1803
|
+
function publishMQTT(topic, payload) {
|
|
1804
|
+
if (!isMQTTEnabled()) {
|
|
1805
|
+
return false;
|
|
1806
|
+
}
|
|
1807
|
+
ensureMQTTClient();
|
|
1808
|
+
if (!client) {
|
|
1809
|
+
return false;
|
|
1810
|
+
}
|
|
1811
|
+
try {
|
|
1812
|
+
client.publish(topic, JSON.stringify(payload), {
|
|
1813
|
+
qos: mqttConfig.qos
|
|
1814
|
+
});
|
|
1815
|
+
return true;
|
|
1816
|
+
} catch (err) {
|
|
1817
|
+
console.warn("".concat(LOG, " publish failed on ").concat(topic, ":"), err);
|
|
1818
|
+
return false;
|
|
1819
|
+
}
|
|
1820
|
+
}
|
|
1821
|
+
function disconnectMQTT() {
|
|
1822
|
+
if (client) {
|
|
1823
|
+
client.end(true);
|
|
1824
|
+
client = null;
|
|
1825
|
+
status = "disconnected";
|
|
1826
|
+
}
|
|
1827
|
+
}
|
|
1718
1828
|
// src/utils/tracking.ts
|
|
1719
1829
|
var cachedBrowserId = null;
|
|
1720
1830
|
function getClientInfo() {
|
|
@@ -1945,139 +2055,120 @@ function getBrowserID(clientInfo) {
|
|
|
1945
2055
|
});
|
|
1946
2056
|
})();
|
|
1947
2057
|
}
|
|
1948
|
-
|
|
1949
|
-
|
|
2058
|
+
function canPublish(licenseKey) {
|
|
2059
|
+
return Boolean(isMQTTEnabled() && licenseKey);
|
|
2060
|
+
}
|
|
2061
|
+
function buildPlayerMetricEvent() {
|
|
1950
2062
|
return _async_to_generator(function() {
|
|
1951
|
-
var
|
|
2063
|
+
var context, flags, _flags_captureAt, _flags_adLoaded, _flags_adDetect, clientInfo, playerId, captureAt;
|
|
2064
|
+
var _arguments = arguments;
|
|
1952
2065
|
return _ts_generator(this, function(_state) {
|
|
1953
2066
|
switch(_state.label){
|
|
1954
2067
|
case 0:
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
};
|
|
1958
|
-
if (licenseKey) {
|
|
1959
|
-
headers["Authorization"] = "Bearer ".concat(licenseKey);
|
|
1960
|
-
}
|
|
2068
|
+
context = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {}, flags = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : {};
|
|
2069
|
+
clientInfo = getClientInfo();
|
|
1961
2070
|
return [
|
|
1962
2071
|
4,
|
|
1963
|
-
|
|
1964
|
-
method: "POST",
|
|
1965
|
-
headers: headers,
|
|
1966
|
-
body: JSON.stringify(body)
|
|
1967
|
-
})
|
|
2072
|
+
getBrowserID(clientInfo)
|
|
1968
2073
|
];
|
|
1969
2074
|
case 1:
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
throw new Error("HTTP error! status: ".concat(response.status));
|
|
1973
|
-
}
|
|
1974
|
-
return [
|
|
1975
|
-
4,
|
|
1976
|
-
response.json()
|
|
1977
|
-
];
|
|
1978
|
-
case 2:
|
|
1979
|
-
_state.sent();
|
|
2075
|
+
playerId = _state.sent();
|
|
2076
|
+
captureAt = (_flags_captureAt = flags.captureAt) !== null && _flags_captureAt !== void 0 ? _flags_captureAt : /* @__PURE__ */ new Date().toISOString();
|
|
1980
2077
|
return [
|
|
1981
|
-
2
|
|
2078
|
+
2,
|
|
2079
|
+
_object_spread({
|
|
2080
|
+
player_id: playerId,
|
|
2081
|
+
device_type: clientInfo.deviceType,
|
|
2082
|
+
os: clientInfo.os.toLowerCase(),
|
|
2083
|
+
ad_loaded: (_flags_adLoaded = flags.adLoaded) !== null && _flags_adLoaded !== void 0 ? _flags_adLoaded : false,
|
|
2084
|
+
ad_detect: (_flags_adDetect = flags.adDetect) !== null && _flags_adDetect !== void 0 ? _flags_adDetect : false,
|
|
2085
|
+
capture_at: captureAt
|
|
2086
|
+
}, context.inputStreamType ? {
|
|
2087
|
+
input_stream_type: context.inputStreamType
|
|
2088
|
+
} : {})
|
|
1982
2089
|
];
|
|
1983
2090
|
}
|
|
1984
2091
|
});
|
|
1985
|
-
})();
|
|
2092
|
+
}).apply(this, arguments);
|
|
1986
2093
|
}
|
|
1987
|
-
function
|
|
1988
|
-
|
|
1989
|
-
|
|
2094
|
+
function publishTracking(licenseKey, channel, body) {
|
|
2095
|
+
ensureMQTTClient();
|
|
2096
|
+
publishMQTT(buildPlayerTopic(licenseKey, channel), body);
|
|
2097
|
+
}
|
|
2098
|
+
function sendInitialTracking(_0) {
|
|
2099
|
+
return _async_to_generator(function(licenseKey) {
|
|
2100
|
+
var context, metricEvent, error;
|
|
2101
|
+
var _arguments = arguments;
|
|
1990
2102
|
return _ts_generator(this, function(_state) {
|
|
1991
2103
|
switch(_state.label){
|
|
1992
2104
|
case 0:
|
|
2105
|
+
context = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : {};
|
|
2106
|
+
if (!canPublish(licenseKey)) return [
|
|
2107
|
+
2
|
|
2108
|
+
];
|
|
2109
|
+
_state.label = 1;
|
|
2110
|
+
case 1:
|
|
1993
2111
|
_state.trys.push([
|
|
1994
|
-
|
|
1995
|
-
|
|
2112
|
+
1,
|
|
2113
|
+
3,
|
|
1996
2114
|
,
|
|
1997
|
-
|
|
2115
|
+
4
|
|
1998
2116
|
]);
|
|
1999
|
-
clientInfo = getClientInfo();
|
|
2000
|
-
return [
|
|
2001
|
-
4,
|
|
2002
|
-
getBrowserID(clientInfo)
|
|
2003
|
-
];
|
|
2004
|
-
case 1:
|
|
2005
|
-
browserId = _state.sent();
|
|
2006
|
-
trackingData = _object_spread({
|
|
2007
|
-
browserId: browserId
|
|
2008
|
-
}, clientInfo);
|
|
2009
|
-
headers = {
|
|
2010
|
-
"Content-Type": "application/json"
|
|
2011
|
-
};
|
|
2012
|
-
if (licenseKey) {
|
|
2013
|
-
headers["Authorization"] = "Bearer ".concat(licenseKey);
|
|
2014
|
-
}
|
|
2015
2117
|
return [
|
|
2016
2118
|
4,
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
body: JSON.stringify(trackingData)
|
|
2119
|
+
buildPlayerMetricEvent(context, {
|
|
2120
|
+
adLoaded: false,
|
|
2121
|
+
adDetect: false
|
|
2021
2122
|
})
|
|
2022
2123
|
];
|
|
2023
2124
|
case 2:
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
response.json()
|
|
2031
|
-
];
|
|
2032
|
-
case 3:
|
|
2033
|
-
_state.sent();
|
|
2125
|
+
metricEvent = _state.sent();
|
|
2126
|
+
publishTracking(licenseKey, "metrics", {
|
|
2127
|
+
events: [
|
|
2128
|
+
metricEvent
|
|
2129
|
+
]
|
|
2130
|
+
});
|
|
2034
2131
|
return [
|
|
2035
2132
|
3,
|
|
2036
|
-
|
|
2133
|
+
4
|
|
2037
2134
|
];
|
|
2038
|
-
case
|
|
2135
|
+
case 3:
|
|
2039
2136
|
error = _state.sent();
|
|
2040
2137
|
console.error("[StormcloudVideoPlayer] Error sending initial tracking data:", error);
|
|
2041
2138
|
return [
|
|
2042
2139
|
3,
|
|
2043
|
-
|
|
2140
|
+
4
|
|
2044
2141
|
];
|
|
2045
|
-
case
|
|
2142
|
+
case 4:
|
|
2046
2143
|
return [
|
|
2047
2144
|
2
|
|
2048
2145
|
];
|
|
2049
2146
|
}
|
|
2050
2147
|
});
|
|
2051
|
-
})();
|
|
2148
|
+
}).apply(this, arguments);
|
|
2052
2149
|
}
|
|
2053
|
-
function sendAdLoadedTracking(
|
|
2054
|
-
return _async_to_generator(function() {
|
|
2055
|
-
var
|
|
2150
|
+
function sendAdLoadedTracking(_0, _1) {
|
|
2151
|
+
return _async_to_generator(function(licenseKey, adLoadedInfo) {
|
|
2152
|
+
var context, error;
|
|
2153
|
+
var _arguments = arguments;
|
|
2056
2154
|
return _ts_generator(this, function(_state) {
|
|
2057
2155
|
switch(_state.label){
|
|
2058
2156
|
case 0:
|
|
2157
|
+
context = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {};
|
|
2158
|
+
_state.label = 1;
|
|
2159
|
+
case 1:
|
|
2059
2160
|
_state.trys.push([
|
|
2060
|
-
|
|
2161
|
+
1,
|
|
2061
2162
|
3,
|
|
2062
2163
|
,
|
|
2063
2164
|
4
|
|
2064
2165
|
]);
|
|
2065
|
-
clientInfo = getClientInfo();
|
|
2066
2166
|
return [
|
|
2067
2167
|
4,
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
trackingData = _object_spread({
|
|
2073
|
-
browserId: browserId
|
|
2074
|
-
}, clientInfo);
|
|
2075
|
-
return [
|
|
2076
|
-
4,
|
|
2077
|
-
sendTrackRequest(licenseKey, _object_spread_props(_object_spread({}, trackingData), {
|
|
2078
|
-
licenseKey: licenseKey,
|
|
2079
|
-
adLoadedInfo: adLoadedInfo
|
|
2080
|
-
}))
|
|
2168
|
+
sendHeartbeat(licenseKey, context, {
|
|
2169
|
+
adLoaded: true,
|
|
2170
|
+
captureAt: adLoadedInfo.timestamp
|
|
2171
|
+
})
|
|
2081
2172
|
];
|
|
2082
2173
|
case 2:
|
|
2083
2174
|
_state.sent();
|
|
@@ -2098,39 +2189,46 @@ function sendAdLoadedTracking(licenseKey, adLoadedInfo) {
|
|
|
2098
2189
|
];
|
|
2099
2190
|
}
|
|
2100
2191
|
});
|
|
2101
|
-
})();
|
|
2192
|
+
}).apply(this, arguments);
|
|
2102
2193
|
}
|
|
2103
|
-
function sendAdImpressionTracking(
|
|
2104
|
-
return _async_to_generator(function() {
|
|
2105
|
-
var
|
|
2194
|
+
function sendAdImpressionTracking(_0, _1) {
|
|
2195
|
+
return _async_to_generator(function(licenseKey, adImpressionInfo) {
|
|
2196
|
+
var context, metricEvent, error;
|
|
2197
|
+
var _arguments = arguments;
|
|
2106
2198
|
return _ts_generator(this, function(_state) {
|
|
2107
2199
|
switch(_state.label){
|
|
2108
2200
|
case 0:
|
|
2201
|
+
context = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {};
|
|
2202
|
+
if (!canPublish(licenseKey)) return [
|
|
2203
|
+
2
|
|
2204
|
+
];
|
|
2205
|
+
_state.label = 1;
|
|
2206
|
+
case 1:
|
|
2109
2207
|
_state.trys.push([
|
|
2110
|
-
|
|
2208
|
+
1,
|
|
2111
2209
|
3,
|
|
2112
2210
|
,
|
|
2113
2211
|
4
|
|
2114
2212
|
]);
|
|
2115
|
-
clientInfo = getClientInfo();
|
|
2116
|
-
return [
|
|
2117
|
-
4,
|
|
2118
|
-
getBrowserID(clientInfo)
|
|
2119
|
-
];
|
|
2120
|
-
case 1:
|
|
2121
|
-
browserId = _state.sent();
|
|
2122
|
-
trackingData = _object_spread({
|
|
2123
|
-
browserId: browserId
|
|
2124
|
-
}, clientInfo);
|
|
2125
2213
|
return [
|
|
2126
2214
|
4,
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
}))
|
|
2215
|
+
buildPlayerMetricEvent(context, {
|
|
2216
|
+
captureAt: adImpressionInfo.timestamp
|
|
2217
|
+
})
|
|
2131
2218
|
];
|
|
2132
2219
|
case 2:
|
|
2133
|
-
_state.sent();
|
|
2220
|
+
metricEvent = _state.sent();
|
|
2221
|
+
publishTracking(licenseKey, "heartbeat", metricEvent);
|
|
2222
|
+
publishTracking(licenseKey, "impressions", {
|
|
2223
|
+
events: [
|
|
2224
|
+
{
|
|
2225
|
+
player_id: metricEvent.player_id,
|
|
2226
|
+
ad_played_count: 1,
|
|
2227
|
+
ad_url: adImpressionInfo.adUrl,
|
|
2228
|
+
capture_at: adImpressionInfo.timestamp
|
|
2229
|
+
}
|
|
2230
|
+
]
|
|
2231
|
+
});
|
|
2134
2232
|
return [
|
|
2135
2233
|
3,
|
|
2136
2234
|
4
|
|
@@ -2148,74 +2246,52 @@ function sendAdImpressionTracking(licenseKey, adImpressionInfo) {
|
|
|
2148
2246
|
];
|
|
2149
2247
|
}
|
|
2150
2248
|
});
|
|
2151
|
-
})();
|
|
2249
|
+
}).apply(this, arguments);
|
|
2152
2250
|
}
|
|
2153
|
-
function sendHeartbeat(
|
|
2154
|
-
return _async_to_generator(function() {
|
|
2155
|
-
var
|
|
2251
|
+
function sendHeartbeat(_0) {
|
|
2252
|
+
return _async_to_generator(function(licenseKey) {
|
|
2253
|
+
var context, flags, heartbeatData, error;
|
|
2254
|
+
var _arguments = arguments;
|
|
2156
2255
|
return _ts_generator(this, function(_state) {
|
|
2157
2256
|
switch(_state.label){
|
|
2158
2257
|
case 0:
|
|
2258
|
+
context = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : {}, flags = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {};
|
|
2259
|
+
if (!canPublish(licenseKey)) return [
|
|
2260
|
+
2
|
|
2261
|
+
];
|
|
2262
|
+
_state.label = 1;
|
|
2263
|
+
case 1:
|
|
2159
2264
|
_state.trys.push([
|
|
2160
|
-
|
|
2161
|
-
|
|
2265
|
+
1,
|
|
2266
|
+
3,
|
|
2162
2267
|
,
|
|
2163
|
-
|
|
2268
|
+
4
|
|
2164
2269
|
]);
|
|
2165
|
-
clientInfo = getClientInfo();
|
|
2166
|
-
return [
|
|
2167
|
-
4,
|
|
2168
|
-
getBrowserID(clientInfo)
|
|
2169
|
-
];
|
|
2170
|
-
case 1:
|
|
2171
|
-
browserId = _state.sent();
|
|
2172
|
-
heartbeatData = {
|
|
2173
|
-
browserId: browserId,
|
|
2174
|
-
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
2175
|
-
};
|
|
2176
|
-
headers = {
|
|
2177
|
-
"Content-Type": "application/json"
|
|
2178
|
-
};
|
|
2179
|
-
if (licenseKey) {
|
|
2180
|
-
headers["Authorization"] = "Bearer ".concat(licenseKey);
|
|
2181
|
-
}
|
|
2182
2270
|
return [
|
|
2183
2271
|
4,
|
|
2184
|
-
|
|
2185
|
-
method: "POST",
|
|
2186
|
-
headers: headers,
|
|
2187
|
-
body: JSON.stringify(heartbeatData)
|
|
2188
|
-
})
|
|
2272
|
+
buildPlayerMetricEvent(context, flags)
|
|
2189
2273
|
];
|
|
2190
2274
|
case 2:
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
throw new Error("HTTP error! status: ".concat(response.status));
|
|
2194
|
-
}
|
|
2195
|
-
return [
|
|
2196
|
-
4,
|
|
2197
|
-
response.json()
|
|
2198
|
-
];
|
|
2199
|
-
case 3:
|
|
2200
|
-
_state.sent();
|
|
2275
|
+
heartbeatData = _state.sent();
|
|
2276
|
+
publishTracking(licenseKey, "heartbeat", heartbeatData);
|
|
2201
2277
|
return [
|
|
2202
2278
|
3,
|
|
2203
|
-
|
|
2279
|
+
4
|
|
2204
2280
|
];
|
|
2205
|
-
case
|
|
2281
|
+
case 3:
|
|
2206
2282
|
error = _state.sent();
|
|
2207
2283
|
console.error("[StormcloudVideoPlayer] Error sending heartbeat:", error);
|
|
2208
2284
|
return [
|
|
2209
2285
|
3,
|
|
2210
|
-
|
|
2286
|
+
4
|
|
2211
2287
|
];
|
|
2212
|
-
case
|
|
2288
|
+
case 4:
|
|
2213
2289
|
return [
|
|
2214
2290
|
2
|
|
2215
2291
|
];
|
|
2216
2292
|
}
|
|
2217
2293
|
});
|
|
2218
|
-
})();
|
|
2294
|
+
}).apply(this, arguments);
|
|
2219
2295
|
}
|
|
2220
2296
|
// src/utils/polyfills.ts
|
|
2221
2297
|
function polyfillURLSearchParams() {
|
|
@@ -2777,6 +2853,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
2777
2853
|
this.config = _object_spread({}, browserOverrides, config);
|
|
2778
2854
|
this.video = config.videoElement;
|
|
2779
2855
|
this.adTransitionGapMs = (_this_config_adTransitionGapMs = this.config.adTransitionGapMs) !== null && _this_config_adTransitionGapMs !== void 0 ? _this_config_adTransitionGapMs : 100;
|
|
2856
|
+
if (this.config.mqttConfig) {
|
|
2857
|
+
configureMQTT(this.config.mqttConfig);
|
|
2858
|
+
}
|
|
2780
2859
|
logBrowserInfo(config.debugAdTiming);
|
|
2781
2860
|
var browserForAdLayer = detectBrowser();
|
|
2782
2861
|
var isSinglePipeline = browserForAdLayer.isSmartTV || !!this.config.singlePipelineMode;
|
|
@@ -3144,7 +3223,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3144
3223
|
source: _this.getAdSource(),
|
|
3145
3224
|
adIndex: _this.currentAdIndex,
|
|
3146
3225
|
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
3147
|
-
});
|
|
3226
|
+
}, _this.getPlayerAnalyticsContext());
|
|
3148
3227
|
}
|
|
3149
3228
|
});
|
|
3150
3229
|
this.adLayer.on("ad_error", function(errorPayload) {
|
|
@@ -3449,7 +3528,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3449
3528
|
key: "initializeTracking",
|
|
3450
3529
|
value: function initializeTracking() {
|
|
3451
3530
|
var _this = this;
|
|
3452
|
-
sendInitialTracking(this.config.licenseKey).then(function() {
|
|
3531
|
+
sendInitialTracking(this.config.licenseKey, this.getPlayerAnalyticsContext()).then(function() {
|
|
3453
3532
|
_this.heartbeatInterval = window.setInterval(function() {
|
|
3454
3533
|
_this.sendHeartbeatIfNeeded();
|
|
3455
3534
|
}, 5e3);
|
|
@@ -3470,7 +3549,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3470
3549
|
var now = Date.now();
|
|
3471
3550
|
if (!this.lastHeartbeatTime || now - this.lastHeartbeatTime > 3e4) {
|
|
3472
3551
|
this.lastHeartbeatTime = now;
|
|
3473
|
-
sendHeartbeat(this.config.licenseKey).catch(function(error) {
|
|
3552
|
+
sendHeartbeat(this.config.licenseKey, this.getPlayerAnalyticsContext()).catch(function(error) {
|
|
3474
3553
|
if (_this.config.debugAdTiming) {
|
|
3475
3554
|
console.warn("[StormcloudVideoPlayer] Failed to send heartbeat:", error);
|
|
3476
3555
|
}
|
|
@@ -3564,6 +3643,14 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3564
3643
|
return "other";
|
|
3565
3644
|
}
|
|
3566
3645
|
},
|
|
3646
|
+
{
|
|
3647
|
+
key: "getPlayerAnalyticsContext",
|
|
3648
|
+
value: function getPlayerAnalyticsContext() {
|
|
3649
|
+
return {
|
|
3650
|
+
inputStreamType: this.getStreamType()
|
|
3651
|
+
};
|
|
3652
|
+
}
|
|
3653
|
+
},
|
|
3567
3654
|
{
|
|
3568
3655
|
key: "shouldShowNativeControls",
|
|
3569
3656
|
value: function shouldShowNativeControls() {
|
|
@@ -4218,7 +4305,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4218
4305
|
sendAdLoadedTracking(_this.config.licenseKey, {
|
|
4219
4306
|
source: _this.getAdSource(),
|
|
4220
4307
|
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
4221
|
-
});
|
|
4308
|
+
}, _this.getPlayerAnalyticsContext());
|
|
4222
4309
|
}
|
|
4223
4310
|
return [
|
|
4224
4311
|
4,
|
|
@@ -4328,7 +4415,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4328
4415
|
sendAdLoadedTracking(_this.config.licenseKey, {
|
|
4329
4416
|
source: _this.getAdSource(),
|
|
4330
4417
|
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
4331
|
-
});
|
|
4418
|
+
}, _this.getPlayerAnalyticsContext());
|
|
4332
4419
|
}
|
|
4333
4420
|
return [
|
|
4334
4421
|
4,
|
|
@@ -4495,7 +4582,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4495
4582
|
sendAdLoadedTracking(this.config.licenseKey, {
|
|
4496
4583
|
source: this.getAdSource(),
|
|
4497
4584
|
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
4498
|
-
});
|
|
4585
|
+
}, this.getPlayerAnalyticsContext());
|
|
4499
4586
|
}
|
|
4500
4587
|
_state.label = 1;
|
|
4501
4588
|
case 1:
|
|
@@ -4694,7 +4781,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4694
4781
|
sendAdLoadedTracking(this.config.licenseKey, {
|
|
4695
4782
|
source: this.getAdSource(),
|
|
4696
4783
|
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
4697
|
-
});
|
|
4784
|
+
}, this.getPlayerAnalyticsContext());
|
|
4698
4785
|
}
|
|
4699
4786
|
return [
|
|
4700
4787
|
4,
|
|
@@ -5639,6 +5726,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5639
5726
|
clearInterval(this.heartbeatInterval);
|
|
5640
5727
|
this.heartbeatInterval = void 0;
|
|
5641
5728
|
}
|
|
5729
|
+
if (isMQTTEnabled()) {
|
|
5730
|
+
disconnectMQTT();
|
|
5731
|
+
}
|
|
5642
5732
|
(_this_hls = this.hls) === null || _this_hls === void 0 ? void 0 : _this_hls.destroy();
|
|
5643
5733
|
(_this_adLayer = this.adLayer) === null || _this_adLayer === void 0 ? void 0 : _this_adLayer.destroy();
|
|
5644
5734
|
this.consecutiveFailures = 0;
|
|
@@ -5888,7 +5978,7 @@ function cachedFetchRSSItems(rssUrl, maxItems) {
|
|
|
5888
5978
|
}
|
|
5889
5979
|
function fetchRSSItems(rssUrl, maxItems) {
|
|
5890
5980
|
return _async_to_generator(function() {
|
|
5891
|
-
var encoded,
|
|
5981
|
+
var encoded, resp, text, unused, resp1, data, unused1, resp2, text1, unused2;
|
|
5892
5982
|
return _ts_generator(this, function(_state) {
|
|
5893
5983
|
switch(_state.label){
|
|
5894
5984
|
case 0:
|
|
@@ -5901,10 +5991,9 @@ function fetchRSSItems(rssUrl, maxItems) {
|
|
|
5901
5991
|
,
|
|
5902
5992
|
6
|
|
5903
5993
|
]);
|
|
5904
|
-
origin = typeof window !== "undefined" ? window.location.origin : "";
|
|
5905
5994
|
return [
|
|
5906
5995
|
4,
|
|
5907
|
-
fetch("
|
|
5996
|
+
fetch("https://adstorm.co/api/rss-proxy?url=".concat(encoded))
|
|
5908
5997
|
];
|
|
5909
5998
|
case 2:
|
|
5910
5999
|
resp = _state.sent();
|
|
@@ -7837,7 +7926,18 @@ var CRITICAL_PROPS = [
|
|
|
7837
7926
|
"licenseKey",
|
|
7838
7927
|
"lowLatencyMode",
|
|
7839
7928
|
"driftToleranceMs",
|
|
7840
|
-
"
|
|
7929
|
+
"immediateManifestAds",
|
|
7930
|
+
"debugAdTiming",
|
|
7931
|
+
"showCustomControls",
|
|
7932
|
+
"adFailsafeTimeoutMs",
|
|
7933
|
+
"minSegmentsBeforePlay",
|
|
7934
|
+
"disableAds",
|
|
7935
|
+
"disableFiller",
|
|
7936
|
+
"singlePipelineMode",
|
|
7937
|
+
"mqttConfig",
|
|
7938
|
+
"adBreakCheckIntervalMs",
|
|
7939
|
+
"maxAdBreakExtensionMs",
|
|
7940
|
+
"adTransitionGapMs"
|
|
7841
7941
|
];
|
|
7842
7942
|
var CONTROLS_HIDE_DELAY = 3e3;
|
|
7843
7943
|
var DEFAULT_PLAYER_ASPECT_RATIO = 16 / 9;
|
|
@@ -7848,7 +7948,7 @@ var PANEL_BASE_RIGHT_OFFSET = 10;
|
|
|
7848
7948
|
var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props) {
|
|
7849
7949
|
var _ref;
|
|
7850
7950
|
var _aiLiveContext_context;
|
|
7851
|
-
var src = props.src, autoplay = props.autoplay, muted = props.muted, lowLatencyMode = props.lowLatencyMode, allowNativeHls = props.allowNativeHls, driftToleranceMs = props.driftToleranceMs, immediateManifestAds = props.immediateManifestAds, debugAdTiming = props.debugAdTiming, showCustomControls = props.showCustomControls, hideLoadingIndicator = props.hideLoadingIndicator, onVolumeToggle = props.onVolumeToggle, onFullscreenToggle = props.onFullscreenToggle, onControlClick = props.onControlClick, onReady = props.onReady, wrapperClassName = props.wrapperClassName, wrapperStyle = props.wrapperStyle, className = props.className, style = props.style, controls = props.controls, playsInline = props.playsInline, preload = props.preload, poster = props.poster, children = props.children, licenseKey = props.licenseKey, minSegmentsBeforePlay = props.minSegmentsBeforePlay, disableAds = props.disableAds, disableFiller = props.disableFiller, swirlProjectId = props.swirlProjectId, swirlShowcaseDemo = props.swirlShowcaseDemo, swirlOverlayApiBaseUrl = props.swirlOverlayApiBaseUrl, swirlOverlayCoordinateSpace = props.swirlOverlayCoordinateSpace, adcisionChannelId = props.adcisionChannelId, disableOverlays = props.disableOverlays, showAdsControl = props.showAdsControl, showOverlaysControl = props.showOverlaysControl, showAiContextControl = props.showAiContextControl, showDebugControl = props.showDebugControl, restVideoAttrs = _object_without_properties(props, [
|
|
7951
|
+
var src = props.src, autoplay = props.autoplay, muted = props.muted, lowLatencyMode = props.lowLatencyMode, allowNativeHls = props.allowNativeHls, driftToleranceMs = props.driftToleranceMs, immediateManifestAds = props.immediateManifestAds, debugAdTiming = props.debugAdTiming, showCustomControls = props.showCustomControls, hideLoadingIndicator = props.hideLoadingIndicator, onVolumeToggle = props.onVolumeToggle, onFullscreenToggle = props.onFullscreenToggle, onControlClick = props.onControlClick, onReady = props.onReady, wrapperClassName = props.wrapperClassName, wrapperStyle = props.wrapperStyle, className = props.className, style = props.style, controls = props.controls, playsInline = props.playsInline, preload = props.preload, poster = props.poster, children = props.children, licenseKey = props.licenseKey, adFailsafeTimeoutMs = props.adFailsafeTimeoutMs, minSegmentsBeforePlay = props.minSegmentsBeforePlay, disableAds = props.disableAds, disableFiller = props.disableFiller, singlePipelineMode = props.singlePipelineMode, mqttConfig2 = props.mqttConfig, adBreakCheckIntervalMs = props.adBreakCheckIntervalMs, maxAdBreakExtensionMs = props.maxAdBreakExtensionMs, adTransitionGapMs = props.adTransitionGapMs, swirlProjectId = props.swirlProjectId, swirlShowcaseDemo = props.swirlShowcaseDemo, swirlOverlayApiBaseUrl = props.swirlOverlayApiBaseUrl, swirlOverlayCoordinateSpace = props.swirlOverlayCoordinateSpace, adcisionChannelId = props.adcisionChannelId, disableOverlays = props.disableOverlays, showAdsControl = props.showAdsControl, showOverlaysControl = props.showOverlaysControl, showAiContextControl = props.showAiContextControl, showDebugControl = props.showDebugControl, restVideoAttrs = _object_without_properties(props, [
|
|
7852
7952
|
"src",
|
|
7853
7953
|
"autoplay",
|
|
7854
7954
|
"muted",
|
|
@@ -7873,9 +7973,15 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
|
|
|
7873
7973
|
"poster",
|
|
7874
7974
|
"children",
|
|
7875
7975
|
"licenseKey",
|
|
7976
|
+
"adFailsafeTimeoutMs",
|
|
7876
7977
|
"minSegmentsBeforePlay",
|
|
7877
7978
|
"disableAds",
|
|
7878
7979
|
"disableFiller",
|
|
7980
|
+
"singlePipelineMode",
|
|
7981
|
+
"mqttConfig",
|
|
7982
|
+
"adBreakCheckIntervalMs",
|
|
7983
|
+
"maxAdBreakExtensionMs",
|
|
7984
|
+
"adTransitionGapMs",
|
|
7879
7985
|
"swirlProjectId",
|
|
7880
7986
|
"swirlShowcaseDemo",
|
|
7881
7987
|
"swirlOverlayApiBaseUrl",
|
|
@@ -8116,7 +8222,7 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
|
|
|
8116
8222
|
var debugPanelBottomOffset = shouldShowEnhancedControls ? Math.max(74, 92 * responsiveScale) : Math.max(52, 58 * responsiveScale);
|
|
8117
8223
|
var criticalPropsKey = (0, import_react2.useMemo)(function() {
|
|
8118
8224
|
var baseParts = CRITICAL_PROPS.map(function(prop) {
|
|
8119
|
-
return prop === "src" ? "src:".concat(effectiveSrc) : "".concat(prop, ":").concat(props[prop]);
|
|
8225
|
+
return prop === "src" ? "src:".concat(effectiveSrc) : "".concat(prop, ":").concat(JSON.stringify(props[prop]));
|
|
8120
8226
|
}).join("|");
|
|
8121
8227
|
return "".concat(baseParts, "|adcisionChannelId:").concat(adcisionChannelId !== null && adcisionChannelId !== void 0 ? adcisionChannelId : "");
|
|
8122
8228
|
}, [
|
|
@@ -8125,8 +8231,19 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
|
|
|
8125
8231
|
licenseKey,
|
|
8126
8232
|
lowLatencyMode,
|
|
8127
8233
|
driftToleranceMs,
|
|
8234
|
+
immediateManifestAds,
|
|
8128
8235
|
adcisionChannelId,
|
|
8129
|
-
debugAdTiming
|
|
8236
|
+
debugAdTiming,
|
|
8237
|
+
showCustomControls,
|
|
8238
|
+
adFailsafeTimeoutMs,
|
|
8239
|
+
minSegmentsBeforePlay,
|
|
8240
|
+
disableAds,
|
|
8241
|
+
disableFiller,
|
|
8242
|
+
singlePipelineMode,
|
|
8243
|
+
mqttConfig2,
|
|
8244
|
+
adBreakCheckIntervalMs,
|
|
8245
|
+
maxAdBreakExtensionMs,
|
|
8246
|
+
adTransitionGapMs
|
|
8130
8247
|
]);
|
|
8131
8248
|
(0, import_react2.useEffect)(function() {
|
|
8132
8249
|
if (typeof window === "undefined") return;
|
|
@@ -8160,9 +8277,15 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
|
|
|
8160
8277
|
if (onFullscreenToggle !== void 0) cfg.onFullscreenToggle = onFullscreenToggle;
|
|
8161
8278
|
if (onControlClick !== void 0) cfg.onControlClick = onControlClick;
|
|
8162
8279
|
if (licenseKey !== void 0) cfg.licenseKey = licenseKey;
|
|
8280
|
+
if (adFailsafeTimeoutMs !== void 0) cfg.adFailsafeTimeoutMs = adFailsafeTimeoutMs;
|
|
8163
8281
|
if (minSegmentsBeforePlay !== void 0) cfg.minSegmentsBeforePlay = minSegmentsBeforePlay;
|
|
8164
8282
|
if (disableAds !== void 0) cfg.disableAds = disableAds;
|
|
8165
8283
|
cfg.disableFiller = disableFiller !== null && disableFiller !== void 0 ? disableFiller : true;
|
|
8284
|
+
if (singlePipelineMode !== void 0) cfg.singlePipelineMode = singlePipelineMode;
|
|
8285
|
+
if (mqttConfig2 !== void 0) cfg.mqttConfig = mqttConfig2;
|
|
8286
|
+
if (adBreakCheckIntervalMs !== void 0) cfg.adBreakCheckIntervalMs = adBreakCheckIntervalMs;
|
|
8287
|
+
if (maxAdBreakExtensionMs !== void 0) cfg.maxAdBreakExtensionMs = maxAdBreakExtensionMs;
|
|
8288
|
+
if (adTransitionGapMs !== void 0) cfg.adTransitionGapMs = adTransitionGapMs;
|
|
8166
8289
|
if (adcisionChannelId !== void 0) {
|
|
8167
8290
|
cfg.projectId = String(adcisionChannelId);
|
|
8168
8291
|
cfg.channelId = adcisionChannelId;
|