stormcloud-video-player 0.3.67 → 0.3.68
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 +85 -12
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +5 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.js +85 -12
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +85 -12
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +5 -0
- package/lib/players/HlsPlayer.cjs +85 -12
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +85 -12
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.cjs +11 -3
- package/lib/sdk/hlsAdPlayer.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +85 -12
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/package.json +1 -1
package/lib/players/index.cjs
CHANGED
|
@@ -1819,7 +1819,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1819
1819
|
}
|
|
1820
1820
|
var adElement = xmlDoc.querySelector("Ad");
|
|
1821
1821
|
if (!adElement) {
|
|
1822
|
-
console.warn("[HlsAdPlayer] No Ad element found in VAST XML");
|
|
1822
|
+
console.warn("[HlsAdPlayer] No Ad element found in VAST XML (no fill). Content (first 2000 chars):", xmlString.substring(0, 2e3));
|
|
1823
1823
|
return null;
|
|
1824
1824
|
}
|
|
1825
1825
|
var adId = adElement.getAttribute("id") || "unknown";
|
|
@@ -1915,7 +1915,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1915
1915
|
}
|
|
1916
1916
|
function fetchAndParseVastAd(vastTagUrl) {
|
|
1917
1917
|
return _async_to_generator(function() {
|
|
1918
|
-
var response, vastXml;
|
|
1918
|
+
var response, vastXml, trimmedXml;
|
|
1919
1919
|
return _ts_generator(this, function(_state) {
|
|
1920
1920
|
switch(_state.label){
|
|
1921
1921
|
case 0:
|
|
@@ -1941,8 +1941,16 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1941
1941
|
];
|
|
1942
1942
|
case 2:
|
|
1943
1943
|
vastXml = _state.sent();
|
|
1944
|
-
console.log("[HlsAdPlayer] VAST XML received");
|
|
1944
|
+
console.log("[HlsAdPlayer] VAST XML received (length=".concat(vastXml.length, ")"));
|
|
1945
1945
|
console.log("[HlsAdPlayer] VAST XML content (first 2000 chars):", vastXml.substring(0, 2e3));
|
|
1946
|
+
trimmedXml = vastXml.trim();
|
|
1947
|
+
if (trimmedXml.length === 0) {
|
|
1948
|
+
console.warn("[HlsAdPlayer] VAST response body is empty (no fill)");
|
|
1949
|
+
return [
|
|
1950
|
+
2,
|
|
1951
|
+
null
|
|
1952
|
+
];
|
|
1953
|
+
}
|
|
1946
1954
|
return [
|
|
1947
1955
|
2,
|
|
1948
1956
|
parseVastXml(vastXml)
|
|
@@ -3382,6 +3390,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3382
3390
|
this.preloadPoolActive = false;
|
|
3383
3391
|
this.preloadPoolLoopRunning = false;
|
|
3384
3392
|
this.adDetectSentForCurrentBreak = false;
|
|
3393
|
+
this.latencyProfileApplied = false;
|
|
3385
3394
|
this.continuousFetchLoopRunning = false;
|
|
3386
3395
|
initializePolyfills();
|
|
3387
3396
|
var browserOverrides = getBrowserConfigOverrides();
|
|
@@ -3498,24 +3507,21 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3498
3507
|
2
|
|
3499
3508
|
];
|
|
3500
3509
|
case 7:
|
|
3501
|
-
this.hls = new import_hls2.default(
|
|
3510
|
+
this.hls = new import_hls2.default({
|
|
3502
3511
|
enableWorker: true,
|
|
3503
3512
|
backBufferLength: 30,
|
|
3504
3513
|
liveDurationInfinity: true,
|
|
3505
3514
|
lowLatencyMode: !!this.config.lowLatencyMode,
|
|
3506
|
-
maxLiveSyncPlaybackRate:
|
|
3507
|
-
}, this.config.lowLatencyMode ? {
|
|
3508
|
-
liveSyncDuration: 2
|
|
3509
|
-
} : {}), {
|
|
3515
|
+
maxLiveSyncPlaybackRate: 1.1,
|
|
3510
3516
|
maxBufferLength: 30,
|
|
3511
3517
|
maxMaxBufferLength: 600,
|
|
3512
3518
|
maxBufferSize: 60 * 1e3 * 1e3,
|
|
3513
|
-
maxBufferHole:
|
|
3519
|
+
maxBufferHole: 1,
|
|
3514
3520
|
highBufferWatchdogPeriod: 2,
|
|
3515
|
-
nudgeOffset: 0.
|
|
3516
|
-
nudgeMaxRetry:
|
|
3521
|
+
nudgeOffset: 0.2,
|
|
3522
|
+
nudgeMaxRetry: 5,
|
|
3517
3523
|
startPosition: -1
|
|
3518
|
-
})
|
|
3524
|
+
});
|
|
3519
3525
|
this.hls.on(import_hls2.default.Events.MEDIA_ATTACHED, function() {
|
|
3520
3526
|
var _this_hls;
|
|
3521
3527
|
(_this_hls = _this.hls) === null || _this_hls === void 0 ? void 0 : _this_hls.loadSource(_this.config.src);
|
|
@@ -3559,6 +3565,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3559
3565
|
this.bufferedSegmentsCount = 0;
|
|
3560
3566
|
this.hasInitialBufferCompleted = false;
|
|
3561
3567
|
this.shouldAutoplayAfterBuffering = !!this.config.autoplay;
|
|
3568
|
+
this.latencyProfileApplied = false;
|
|
3569
|
+
this.detectedLowLatencyStream = void 0;
|
|
3562
3570
|
minSegments = (_this_config_minSegmentsBeforePlay = this.config.minSegmentsBeforePlay) !== null && _this_config_minSegmentsBeforePlay !== void 0 ? _this_config_minSegmentsBeforePlay : 2;
|
|
3563
3571
|
if (this.config.debugAdTiming) {
|
|
3564
3572
|
console.log("[StormcloudVideoPlayer] Waiting for", minSegments, "segments to buffer before playback");
|
|
@@ -3588,6 +3596,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3588
3596
|
}).call(_this);
|
|
3589
3597
|
});
|
|
3590
3598
|
this.hls.on(import_hls2.default.Events.LEVEL_LOADED, function(_evt, data) {
|
|
3599
|
+
_this.applyStreamLatencyProfile(data === null || data === void 0 ? void 0 : data.details);
|
|
3591
3600
|
if (_this.inAdBreak || _this.pendingAdBreak) {
|
|
3592
3601
|
return;
|
|
3593
3602
|
}
|
|
@@ -3867,6 +3876,64 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3867
3876
|
}).call(this);
|
|
3868
3877
|
}
|
|
3869
3878
|
},
|
|
3879
|
+
{
|
|
3880
|
+
key: "applyStreamLatencyProfile",
|
|
3881
|
+
value: function applyStreamLatencyProfile(details) {
|
|
3882
|
+
if (this.latencyProfileApplied || !this.hls) {
|
|
3883
|
+
return;
|
|
3884
|
+
}
|
|
3885
|
+
if (!details) {
|
|
3886
|
+
return;
|
|
3887
|
+
}
|
|
3888
|
+
if (details.live !== true) {
|
|
3889
|
+
this.latencyProfileApplied = true;
|
|
3890
|
+
this.detectedLowLatencyStream = false;
|
|
3891
|
+
return;
|
|
3892
|
+
}
|
|
3893
|
+
var isLowLatencyManifest = this.isLowLatencyManifest(details);
|
|
3894
|
+
var useLowLatency = isLowLatencyManifest && !!this.config.lowLatencyMode;
|
|
3895
|
+
this.detectedLowLatencyStream = useLowLatency;
|
|
3896
|
+
this.latencyProfileApplied = true;
|
|
3897
|
+
var cfg = this.hls.config;
|
|
3898
|
+
if (useLowLatency) {
|
|
3899
|
+
cfg.maxLiveSyncPlaybackRate = 1.5;
|
|
3900
|
+
cfg.maxBufferHole = 0.5;
|
|
3901
|
+
delete cfg.liveSyncDuration;
|
|
3902
|
+
} else {
|
|
3903
|
+
cfg.maxLiveSyncPlaybackRate = 1.1;
|
|
3904
|
+
cfg.maxBufferHole = 1;
|
|
3905
|
+
delete cfg.liveSyncDuration;
|
|
3906
|
+
cfg.liveSyncDurationCount = 3;
|
|
3907
|
+
}
|
|
3908
|
+
if (this.config.debugAdTiming) {
|
|
3909
|
+
var _details_targetduration;
|
|
3910
|
+
console.log("[StormcloudVideoPlayer] Live latency profile: ".concat(useLowLatency ? "LL-HLS (low latency)" : "standard live (stability)"), {
|
|
3911
|
+
isLowLatencyManifest: isLowLatencyManifest,
|
|
3912
|
+
lowLatencyModeRequested: !!this.config.lowLatencyMode,
|
|
3913
|
+
canBlockReload: details.canBlockReload,
|
|
3914
|
+
partTarget: details.partTarget,
|
|
3915
|
+
partHoldBack: details.partHoldBack,
|
|
3916
|
+
partListLength: Array.isArray(details.partList) ? details.partList.length : 0,
|
|
3917
|
+
targetDuration: (_details_targetduration = details.targetduration) !== null && _details_targetduration !== void 0 ? _details_targetduration : details.targetDuration,
|
|
3918
|
+
maxLiveSyncPlaybackRate: cfg.maxLiveSyncPlaybackRate,
|
|
3919
|
+
maxBufferHole: cfg.maxBufferHole
|
|
3920
|
+
});
|
|
3921
|
+
}
|
|
3922
|
+
}
|
|
3923
|
+
},
|
|
3924
|
+
{
|
|
3925
|
+
key: "isLowLatencyManifest",
|
|
3926
|
+
value: function isLowLatencyManifest(details) {
|
|
3927
|
+
if (!details) {
|
|
3928
|
+
return false;
|
|
3929
|
+
}
|
|
3930
|
+
var hasParts = Array.isArray(details.partList) && details.partList.length > 0;
|
|
3931
|
+
var hasPartTarget = typeof details.partTarget === "number" && details.partTarget > 0;
|
|
3932
|
+
var hasPartHoldBack = typeof details.partHoldBack === "number" && details.partHoldBack > 0;
|
|
3933
|
+
var canBlockReload = details.canBlockReload === true;
|
|
3934
|
+
return hasParts || hasPartTarget || hasPartHoldBack || canBlockReload;
|
|
3935
|
+
}
|
|
3936
|
+
},
|
|
3870
3937
|
{
|
|
3871
3938
|
key: "attachImaEventListeners",
|
|
3872
3939
|
value: function attachImaEventListeners() {
|
|
@@ -5855,6 +5922,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5855
5922
|
return !!(this.config.allowNativeHls && !((_this_config_showCustomControls = this.config.showCustomControls) !== null && _this_config_showCustomControls !== void 0 ? _this_config_showCustomControls : false));
|
|
5856
5923
|
}
|
|
5857
5924
|
},
|
|
5925
|
+
{
|
|
5926
|
+
key: "isLowLatencyStream",
|
|
5927
|
+
value: function isLowLatencyStream() {
|
|
5928
|
+
return this.detectedLowLatencyStream;
|
|
5929
|
+
}
|
|
5930
|
+
},
|
|
5858
5931
|
{
|
|
5859
5932
|
key: "shouldContinueLiveStreamDuringAds",
|
|
5860
5933
|
value: function shouldContinueLiveStreamDuringAds() {
|