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
|
@@ -1099,7 +1099,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1099
1099
|
adHls.destroy();
|
|
1100
1100
|
}
|
|
1101
1101
|
adHls = new import_hls.default({
|
|
1102
|
-
enableWorker:
|
|
1102
|
+
enableWorker: typeof globalThis !== "undefined",
|
|
1103
1103
|
lowLatencyMode: false
|
|
1104
1104
|
});
|
|
1105
1105
|
adHls.loadSource(mediaFile.url);
|
|
@@ -1855,6 +1855,9 @@ var DEFAULT_MQTT_CONFIG = {
|
|
|
1855
1855
|
qos: 1
|
|
1856
1856
|
};
|
|
1857
1857
|
var mqttConfig = _object_spread({}, DEFAULT_MQTT_CONFIG);
|
|
1858
|
+
function applyMQTTConfig(overrides) {
|
|
1859
|
+
Object.assign(mqttConfig, overrides);
|
|
1860
|
+
}
|
|
1858
1861
|
function isMQTTEnabled() {
|
|
1859
1862
|
return mqttConfig.enabled;
|
|
1860
1863
|
}
|
|
@@ -3460,7 +3463,7 @@ function removeBrokenAppNameOrphans(params, appName) {
|
|
|
3460
3463
|
try {
|
|
3461
3464
|
for(var _iterator = appName.split("&").slice(1)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
3462
3465
|
var suffix = _step.value;
|
|
3463
|
-
var trimmed = suffix.
|
|
3466
|
+
var trimmed = suffix.replace(/^\s+/, "");
|
|
3464
3467
|
if (!trimmed) continue;
|
|
3465
3468
|
toDelete.push(suffix, " ".concat(trimmed), trimmed);
|
|
3466
3469
|
}
|
|
@@ -3514,7 +3517,7 @@ function normalizeVastTagUrl(raw) {
|
|
|
3514
3517
|
});
|
|
3515
3518
|
if (orphanFragments.length > 0) {
|
|
3516
3519
|
var reconstructed = [
|
|
3517
|
-
anValue.
|
|
3520
|
+
anValue.replace(/\s+$/, "")
|
|
3518
3521
|
].concat(_to_consumable_array(orphanFragments)).filter(Boolean).join(" & ");
|
|
3519
3522
|
url.searchParams.forEach(function(_value, key) {
|
|
3520
3523
|
if (key && INVALID_VAST_PARAM_KEY.test(key)) {
|
|
@@ -5026,6 +5029,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
5026
5029
|
];
|
|
5027
5030
|
case 4:
|
|
5028
5031
|
data = _state.sent();
|
|
5032
|
+
this.applyMqttConfigFromResponse(data);
|
|
5029
5033
|
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;
|
|
5030
5034
|
if (imaPayload) {
|
|
5031
5035
|
decodedPayload = imaPayload;
|
|
@@ -5059,6 +5063,20 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
5059
5063
|
}).call(this);
|
|
5060
5064
|
}
|
|
5061
5065
|
},
|
|
5066
|
+
{
|
|
5067
|
+
key: "applyMqttConfigFromResponse",
|
|
5068
|
+
value: function applyMqttConfigFromResponse(data) {
|
|
5069
|
+
var _data_response;
|
|
5070
|
+
var mqttConfig2 = (_data_response = data.response) === null || _data_response === void 0 ? void 0 : _data_response.mqtt_config;
|
|
5071
|
+
if (!mqttConfig2 || (typeof mqttConfig2 === "undefined" ? "undefined" : _type_of(mqttConfig2)) !== "object") {
|
|
5072
|
+
return;
|
|
5073
|
+
}
|
|
5074
|
+
applyMQTTConfig(mqttConfig2);
|
|
5075
|
+
if (this.debug) {
|
|
5076
|
+
console.log("[StormcloudVideoPlayer] Applied MQTT config from /ads/web:", mqttConfig2);
|
|
5077
|
+
}
|
|
5078
|
+
}
|
|
5079
|
+
},
|
|
5062
5080
|
{
|
|
5063
5081
|
key: "fetchAndParseVmap",
|
|
5064
5082
|
value: function fetchAndParseVmap(vmapUrl) {
|
|
@@ -6187,7 +6205,7 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6187
6205
|
value: function setupHls() {
|
|
6188
6206
|
var _this = this;
|
|
6189
6207
|
this.hls = new import_hls2.default(_object_spread_props(_object_spread({
|
|
6190
|
-
enableWorker:
|
|
6208
|
+
enableWorker: typeof globalThis !== "undefined",
|
|
6191
6209
|
backBufferLength: 30,
|
|
6192
6210
|
liveDurationInfinity: true,
|
|
6193
6211
|
lowLatencyMode: !!this.config.lowLatencyMode,
|
|
@@ -6576,6 +6594,22 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6576
6594
|
return typeof pos === "number" && Number.isFinite(pos) ? pos : void 0;
|
|
6577
6595
|
}
|
|
6578
6596
|
},
|
|
6597
|
+
{
|
|
6598
|
+
key: "restartLoadAt",
|
|
6599
|
+
value: function restartLoadAt(position) {
|
|
6600
|
+
if (!this.hls) {
|
|
6601
|
+
return;
|
|
6602
|
+
}
|
|
6603
|
+
try {
|
|
6604
|
+
this.hls.stopLoad();
|
|
6605
|
+
this.hls.startLoad(position);
|
|
6606
|
+
} catch (error) {
|
|
6607
|
+
if (this.debug) {
|
|
6608
|
+
console.warn("[StormcloudVideoPlayer] Failed to restart HLS load at live edge:", error);
|
|
6609
|
+
}
|
|
6610
|
+
}
|
|
6611
|
+
}
|
|
6612
|
+
},
|
|
6579
6613
|
{
|
|
6580
6614
|
key: "destroy",
|
|
6581
6615
|
value: function destroy() {
|
|
@@ -7892,11 +7926,56 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
7892
7926
|
console.log("[StormcloudVideoPlayer] Live break end — snapping to live edge: ".concat(this.host.video.currentTime.toFixed(2), "s → ").concat(liveSyncPos.toFixed(2), "s"));
|
|
7893
7927
|
}
|
|
7894
7928
|
this.host.video.currentTime = liveSyncPos;
|
|
7929
|
+
this.host.restartHlsLoad(liveSyncPos);
|
|
7895
7930
|
}
|
|
7931
|
+
this.resumeContentPlayback();
|
|
7932
|
+
this.monitorLiveResumeStall(0, this.host.video.currentTime);
|
|
7933
|
+
return;
|
|
7896
7934
|
}
|
|
7897
7935
|
this.resumeContentPlayback();
|
|
7898
7936
|
}
|
|
7899
7937
|
},
|
|
7938
|
+
{
|
|
7939
|
+
key: "monitorLiveResumeStall",
|
|
7940
|
+
value: function monitorLiveResumeStall(attempt, lastTime) {
|
|
7941
|
+
var _this = this;
|
|
7942
|
+
var maxAttempts = 3;
|
|
7943
|
+
var checkDelayMs = 2500;
|
|
7944
|
+
window.setTimeout(function() {
|
|
7945
|
+
if (_this.inAdBreak) {
|
|
7946
|
+
return;
|
|
7947
|
+
}
|
|
7948
|
+
var currentTime = _this.host.video.currentTime;
|
|
7949
|
+
var advanced = currentTime > lastTime + 0.25;
|
|
7950
|
+
if (advanced && !_this.host.video.paused) {
|
|
7951
|
+
if (_this.debug) {
|
|
7952
|
+
console.log("[StormcloudVideoPlayer] Live stream resumed successfully after ad break");
|
|
7953
|
+
}
|
|
7954
|
+
return;
|
|
7955
|
+
}
|
|
7956
|
+
if (attempt >= maxAttempts) {
|
|
7957
|
+
if (_this.debug) {
|
|
7958
|
+
console.warn("[StormcloudVideoPlayer] Live stream failed to resume after ".concat(maxAttempts, " recovery attempts (t=").concat(currentTime.toFixed(2), "s)"));
|
|
7959
|
+
}
|
|
7960
|
+
return;
|
|
7961
|
+
}
|
|
7962
|
+
if (_this.debug) {
|
|
7963
|
+
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, ")"));
|
|
7964
|
+
}
|
|
7965
|
+
var liveSyncPos = _this.host.getLiveSyncPosition();
|
|
7966
|
+
var reloadPos = liveSyncPos != null && liveSyncPos > currentTime ? liveSyncPos : currentTime;
|
|
7967
|
+
if (liveSyncPos != null && liveSyncPos > currentTime) {
|
|
7968
|
+
_this.host.video.currentTime = liveSyncPos;
|
|
7969
|
+
}
|
|
7970
|
+
_this.host.restartHlsLoad(reloadPos);
|
|
7971
|
+
if (_this.host.video.paused) {
|
|
7972
|
+
var _this_host_video_play;
|
|
7973
|
+
(_this_host_video_play = _this.host.video.play()) === null || _this_host_video_play === void 0 ? void 0 : _this_host_video_play.catch(function() {});
|
|
7974
|
+
}
|
|
7975
|
+
_this.monitorLiveResumeStall(attempt + 1, _this.host.video.currentTime);
|
|
7976
|
+
}, checkDelayMs);
|
|
7977
|
+
}
|
|
7978
|
+
},
|
|
7900
7979
|
{
|
|
7901
7980
|
key: "resumeContentPlayback",
|
|
7902
7981
|
value: function resumeContentPlayback() {
|
|
@@ -8045,6 +8124,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8045
8124
|
getLiveSyncPosition: function getLiveSyncPosition() {
|
|
8046
8125
|
return _this.hlsEngine.getLiveSyncPosition();
|
|
8047
8126
|
},
|
|
8127
|
+
restartHlsLoad: function restartHlsLoad(position) {
|
|
8128
|
+
return _this.hlsEngine.restartLoadAt(position);
|
|
8129
|
+
},
|
|
8048
8130
|
generatePodVastUrl: function generatePodVastUrl(base, breakDurationMs) {
|
|
8049
8131
|
return _this.generatePodVastUrl(base, breakDurationMs);
|
|
8050
8132
|
}
|