stormcloud-video-player 0.8.35 → 0.8.37
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 +1 -1
- package/lib/index.cjs +83 -4
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +19 -19
- package/lib/index.d.ts +19 -19
- package/lib/index.js +83 -4
- package/lib/index.js.map +1 -1
- package/lib/player/AdBreakOrchestrator.cjs +45 -0
- package/lib/player/AdBreakOrchestrator.cjs.map +1 -1
- package/lib/player/AdBreakOrchestrator.d.cts +2 -0
- package/lib/player/AdConfigManager.cjs +20 -2
- package/lib/player/AdConfigManager.cjs.map +1 -1
- package/lib/player/AdConfigManager.d.cts +1 -0
- package/lib/player/HlsEngine.cjs +17 -1
- package/lib/player/HlsEngine.cjs.map +1 -1
- package/lib/player/HlsEngine.d.cts +1 -0
- package/lib/player/StormcloudVideoPlayer.cjs +86 -4
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.cjs +86 -4
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +86 -4
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.cjs +1 -1
- package/lib/sdk/hlsAdPlayer.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +86 -4
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/utils/vastMacros.cjs +2 -2
- package/lib/utils/vastMacros.cjs.map +1 -1
- package/package.json +1 -1
|
@@ -1136,7 +1136,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1136
1136
|
adHls.destroy();
|
|
1137
1137
|
}
|
|
1138
1138
|
adHls = new import_hls.default({
|
|
1139
|
-
enableWorker:
|
|
1139
|
+
enableWorker: typeof globalThis !== "undefined",
|
|
1140
1140
|
lowLatencyMode: false
|
|
1141
1141
|
});
|
|
1142
1142
|
adHls.loadSource(mediaFile.url);
|
|
@@ -1892,6 +1892,9 @@ var DEFAULT_MQTT_CONFIG = {
|
|
|
1892
1892
|
qos: 1
|
|
1893
1893
|
};
|
|
1894
1894
|
var mqttConfig = _object_spread({}, DEFAULT_MQTT_CONFIG);
|
|
1895
|
+
function applyMQTTConfig(overrides) {
|
|
1896
|
+
Object.assign(mqttConfig, overrides);
|
|
1897
|
+
}
|
|
1895
1898
|
function isMQTTEnabled() {
|
|
1896
1899
|
return mqttConfig.enabled;
|
|
1897
1900
|
}
|
|
@@ -3497,7 +3500,7 @@ function removeBrokenAppNameOrphans(params, appName) {
|
|
|
3497
3500
|
try {
|
|
3498
3501
|
for(var _iterator = appName.split("&").slice(1)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
3499
3502
|
var suffix = _step.value;
|
|
3500
|
-
var trimmed = suffix.
|
|
3503
|
+
var trimmed = suffix.replace(/^\s+/, "");
|
|
3501
3504
|
if (!trimmed) continue;
|
|
3502
3505
|
toDelete.push(suffix, " ".concat(trimmed), trimmed);
|
|
3503
3506
|
}
|
|
@@ -3551,7 +3554,7 @@ function normalizeVastTagUrl(raw) {
|
|
|
3551
3554
|
});
|
|
3552
3555
|
if (orphanFragments.length > 0) {
|
|
3553
3556
|
var reconstructed = [
|
|
3554
|
-
anValue.
|
|
3557
|
+
anValue.replace(/\s+$/, "")
|
|
3555
3558
|
].concat(_to_consumable_array(orphanFragments)).filter(Boolean).join(" & ");
|
|
3556
3559
|
url.searchParams.forEach(function(_value, key) {
|
|
3557
3560
|
if (key && INVALID_VAST_PARAM_KEY.test(key)) {
|
|
@@ -5063,6 +5066,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
5063
5066
|
];
|
|
5064
5067
|
case 4:
|
|
5065
5068
|
data = _state.sent();
|
|
5069
|
+
this.applyMqttConfigFromResponse(data);
|
|
5066
5070
|
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;
|
|
5067
5071
|
if (imaPayload) {
|
|
5068
5072
|
decodedPayload = imaPayload;
|
|
@@ -5096,6 +5100,20 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
5096
5100
|
}).call(this);
|
|
5097
5101
|
}
|
|
5098
5102
|
},
|
|
5103
|
+
{
|
|
5104
|
+
key: "applyMqttConfigFromResponse",
|
|
5105
|
+
value: function applyMqttConfigFromResponse(data) {
|
|
5106
|
+
var _data_response;
|
|
5107
|
+
var mqttConfig2 = (_data_response = data.response) === null || _data_response === void 0 ? void 0 : _data_response.mqtt_config;
|
|
5108
|
+
if (!mqttConfig2 || (typeof mqttConfig2 === "undefined" ? "undefined" : _type_of(mqttConfig2)) !== "object") {
|
|
5109
|
+
return;
|
|
5110
|
+
}
|
|
5111
|
+
applyMQTTConfig(mqttConfig2);
|
|
5112
|
+
if (this.debug) {
|
|
5113
|
+
console.log("[StormcloudVideoPlayer] Applied MQTT config from /ads/web:", mqttConfig2);
|
|
5114
|
+
}
|
|
5115
|
+
}
|
|
5116
|
+
},
|
|
5099
5117
|
{
|
|
5100
5118
|
key: "fetchAndParseVmap",
|
|
5101
5119
|
value: function fetchAndParseVmap(vmapUrl) {
|
|
@@ -6224,7 +6242,7 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6224
6242
|
value: function setupHls() {
|
|
6225
6243
|
var _this = this;
|
|
6226
6244
|
this.hls = new import_hls2.default(_object_spread_props(_object_spread({
|
|
6227
|
-
enableWorker:
|
|
6245
|
+
enableWorker: typeof globalThis !== "undefined",
|
|
6228
6246
|
backBufferLength: 30,
|
|
6229
6247
|
liveDurationInfinity: true,
|
|
6230
6248
|
lowLatencyMode: !!this.config.lowLatencyMode,
|
|
@@ -6613,6 +6631,22 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6613
6631
|
return typeof pos === "number" && Number.isFinite(pos) ? pos : void 0;
|
|
6614
6632
|
}
|
|
6615
6633
|
},
|
|
6634
|
+
{
|
|
6635
|
+
key: "restartLoadAt",
|
|
6636
|
+
value: function restartLoadAt(position) {
|
|
6637
|
+
if (!this.hls) {
|
|
6638
|
+
return;
|
|
6639
|
+
}
|
|
6640
|
+
try {
|
|
6641
|
+
this.hls.stopLoad();
|
|
6642
|
+
this.hls.startLoad(position);
|
|
6643
|
+
} catch (error) {
|
|
6644
|
+
if (this.debug) {
|
|
6645
|
+
console.warn("[StormcloudVideoPlayer] Failed to restart HLS load at live edge:", error);
|
|
6646
|
+
}
|
|
6647
|
+
}
|
|
6648
|
+
}
|
|
6649
|
+
},
|
|
6616
6650
|
{
|
|
6617
6651
|
key: "destroy",
|
|
6618
6652
|
value: function destroy() {
|
|
@@ -7929,11 +7963,56 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
7929
7963
|
console.log("[StormcloudVideoPlayer] Live break end — snapping to live edge: ".concat(this.host.video.currentTime.toFixed(2), "s → ").concat(liveSyncPos.toFixed(2), "s"));
|
|
7930
7964
|
}
|
|
7931
7965
|
this.host.video.currentTime = liveSyncPos;
|
|
7966
|
+
this.host.restartHlsLoad(liveSyncPos);
|
|
7932
7967
|
}
|
|
7968
|
+
this.resumeContentPlayback();
|
|
7969
|
+
this.monitorLiveResumeStall(0, this.host.video.currentTime);
|
|
7970
|
+
return;
|
|
7933
7971
|
}
|
|
7934
7972
|
this.resumeContentPlayback();
|
|
7935
7973
|
}
|
|
7936
7974
|
},
|
|
7975
|
+
{
|
|
7976
|
+
key: "monitorLiveResumeStall",
|
|
7977
|
+
value: function monitorLiveResumeStall(attempt, lastTime) {
|
|
7978
|
+
var _this = this;
|
|
7979
|
+
var maxAttempts = 3;
|
|
7980
|
+
var checkDelayMs = 2500;
|
|
7981
|
+
window.setTimeout(function() {
|
|
7982
|
+
if (_this.inAdBreak) {
|
|
7983
|
+
return;
|
|
7984
|
+
}
|
|
7985
|
+
var currentTime = _this.host.video.currentTime;
|
|
7986
|
+
var advanced = currentTime > lastTime + 0.25;
|
|
7987
|
+
if (advanced && !_this.host.video.paused) {
|
|
7988
|
+
if (_this.debug) {
|
|
7989
|
+
console.log("[StormcloudVideoPlayer] Live stream resumed successfully after ad break");
|
|
7990
|
+
}
|
|
7991
|
+
return;
|
|
7992
|
+
}
|
|
7993
|
+
if (attempt >= maxAttempts) {
|
|
7994
|
+
if (_this.debug) {
|
|
7995
|
+
console.warn("[StormcloudVideoPlayer] Live stream failed to resume after ".concat(maxAttempts, " recovery attempts (t=").concat(currentTime.toFixed(2), "s)"));
|
|
7996
|
+
}
|
|
7997
|
+
return;
|
|
7998
|
+
}
|
|
7999
|
+
if (_this.debug) {
|
|
8000
|
+
console.warn("[StormcloudVideoPlayer] Content stalled after ad break (t=".concat(currentTime.toFixed(2), "s) — forcing HLS reload at live edge (attempt ").concat(attempt + 1, "/").concat(maxAttempts, ")"));
|
|
8001
|
+
}
|
|
8002
|
+
var liveSyncPos = _this.host.getLiveSyncPosition();
|
|
8003
|
+
var reloadPos = liveSyncPos != null && liveSyncPos > currentTime ? liveSyncPos : currentTime;
|
|
8004
|
+
if (liveSyncPos != null && liveSyncPos > currentTime) {
|
|
8005
|
+
_this.host.video.currentTime = liveSyncPos;
|
|
8006
|
+
}
|
|
8007
|
+
_this.host.restartHlsLoad(reloadPos);
|
|
8008
|
+
if (_this.host.video.paused) {
|
|
8009
|
+
var _this_host_video_play;
|
|
8010
|
+
(_this_host_video_play = _this.host.video.play()) === null || _this_host_video_play === void 0 ? void 0 : _this_host_video_play.catch(function() {});
|
|
8011
|
+
}
|
|
8012
|
+
_this.monitorLiveResumeStall(attempt + 1, _this.host.video.currentTime);
|
|
8013
|
+
}, checkDelayMs);
|
|
8014
|
+
}
|
|
8015
|
+
},
|
|
7937
8016
|
{
|
|
7938
8017
|
key: "resumeContentPlayback",
|
|
7939
8018
|
value: function resumeContentPlayback() {
|
|
@@ -8082,6 +8161,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8082
8161
|
getLiveSyncPosition: function getLiveSyncPosition() {
|
|
8083
8162
|
return _this.hlsEngine.getLiveSyncPosition();
|
|
8084
8163
|
},
|
|
8164
|
+
restartHlsLoad: function restartHlsLoad(position) {
|
|
8165
|
+
return _this.hlsEngine.restartLoadAt(position);
|
|
8166
|
+
},
|
|
8085
8167
|
generatePodVastUrl: function generatePodVastUrl(base, breakDurationMs) {
|
|
8086
8168
|
return _this.generatePodVastUrl(base, breakDurationMs);
|
|
8087
8169
|
}
|