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
|
@@ -1731,7 +1731,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1731
1731
|
}
|
|
1732
1732
|
var adElement = xmlDoc.querySelector("Ad");
|
|
1733
1733
|
if (!adElement) {
|
|
1734
|
-
console.warn("[HlsAdPlayer] No Ad element found in VAST XML");
|
|
1734
|
+
console.warn("[HlsAdPlayer] No Ad element found in VAST XML (no fill). Content (first 2000 chars):", xmlString.substring(0, 2e3));
|
|
1735
1735
|
return null;
|
|
1736
1736
|
}
|
|
1737
1737
|
var adId = adElement.getAttribute("id") || "unknown";
|
|
@@ -1827,7 +1827,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1827
1827
|
}
|
|
1828
1828
|
function fetchAndParseVastAd(vastTagUrl) {
|
|
1829
1829
|
return _async_to_generator(function() {
|
|
1830
|
-
var response, vastXml;
|
|
1830
|
+
var response, vastXml, trimmedXml;
|
|
1831
1831
|
return _ts_generator(this, function(_state) {
|
|
1832
1832
|
switch(_state.label){
|
|
1833
1833
|
case 0:
|
|
@@ -1853,8 +1853,16 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1853
1853
|
];
|
|
1854
1854
|
case 2:
|
|
1855
1855
|
vastXml = _state.sent();
|
|
1856
|
-
console.log("[HlsAdPlayer] VAST XML received");
|
|
1856
|
+
console.log("[HlsAdPlayer] VAST XML received (length=".concat(vastXml.length, ")"));
|
|
1857
1857
|
console.log("[HlsAdPlayer] VAST XML content (first 2000 chars):", vastXml.substring(0, 2e3));
|
|
1858
|
+
trimmedXml = vastXml.trim();
|
|
1859
|
+
if (trimmedXml.length === 0) {
|
|
1860
|
+
console.warn("[HlsAdPlayer] VAST response body is empty (no fill)");
|
|
1861
|
+
return [
|
|
1862
|
+
2,
|
|
1863
|
+
null
|
|
1864
|
+
];
|
|
1865
|
+
}
|
|
1858
1866
|
return [
|
|
1859
1867
|
2,
|
|
1860
1868
|
parseVastXml(vastXml)
|
|
@@ -3294,6 +3302,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3294
3302
|
this.preloadPoolActive = false;
|
|
3295
3303
|
this.preloadPoolLoopRunning = false;
|
|
3296
3304
|
this.adDetectSentForCurrentBreak = false;
|
|
3305
|
+
this.latencyProfileApplied = false;
|
|
3297
3306
|
this.continuousFetchLoopRunning = false;
|
|
3298
3307
|
initializePolyfills();
|
|
3299
3308
|
var browserOverrides = getBrowserConfigOverrides();
|
|
@@ -3410,24 +3419,21 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3410
3419
|
2
|
|
3411
3420
|
];
|
|
3412
3421
|
case 7:
|
|
3413
|
-
this.hls = new import_hls2.default(
|
|
3422
|
+
this.hls = new import_hls2.default({
|
|
3414
3423
|
enableWorker: true,
|
|
3415
3424
|
backBufferLength: 30,
|
|
3416
3425
|
liveDurationInfinity: true,
|
|
3417
3426
|
lowLatencyMode: !!this.config.lowLatencyMode,
|
|
3418
|
-
maxLiveSyncPlaybackRate:
|
|
3419
|
-
}, this.config.lowLatencyMode ? {
|
|
3420
|
-
liveSyncDuration: 2
|
|
3421
|
-
} : {}), {
|
|
3427
|
+
maxLiveSyncPlaybackRate: 1.1,
|
|
3422
3428
|
maxBufferLength: 30,
|
|
3423
3429
|
maxMaxBufferLength: 600,
|
|
3424
3430
|
maxBufferSize: 60 * 1e3 * 1e3,
|
|
3425
|
-
maxBufferHole:
|
|
3431
|
+
maxBufferHole: 1,
|
|
3426
3432
|
highBufferWatchdogPeriod: 2,
|
|
3427
|
-
nudgeOffset: 0.
|
|
3428
|
-
nudgeMaxRetry:
|
|
3433
|
+
nudgeOffset: 0.2,
|
|
3434
|
+
nudgeMaxRetry: 5,
|
|
3429
3435
|
startPosition: -1
|
|
3430
|
-
})
|
|
3436
|
+
});
|
|
3431
3437
|
this.hls.on(import_hls2.default.Events.MEDIA_ATTACHED, function() {
|
|
3432
3438
|
var _this_hls;
|
|
3433
3439
|
(_this_hls = _this.hls) === null || _this_hls === void 0 ? void 0 : _this_hls.loadSource(_this.config.src);
|
|
@@ -3471,6 +3477,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3471
3477
|
this.bufferedSegmentsCount = 0;
|
|
3472
3478
|
this.hasInitialBufferCompleted = false;
|
|
3473
3479
|
this.shouldAutoplayAfterBuffering = !!this.config.autoplay;
|
|
3480
|
+
this.latencyProfileApplied = false;
|
|
3481
|
+
this.detectedLowLatencyStream = void 0;
|
|
3474
3482
|
minSegments = (_this_config_minSegmentsBeforePlay = this.config.minSegmentsBeforePlay) !== null && _this_config_minSegmentsBeforePlay !== void 0 ? _this_config_minSegmentsBeforePlay : 2;
|
|
3475
3483
|
if (this.config.debugAdTiming) {
|
|
3476
3484
|
console.log("[StormcloudVideoPlayer] Waiting for", minSegments, "segments to buffer before playback");
|
|
@@ -3500,6 +3508,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3500
3508
|
}).call(_this);
|
|
3501
3509
|
});
|
|
3502
3510
|
this.hls.on(import_hls2.default.Events.LEVEL_LOADED, function(_evt, data) {
|
|
3511
|
+
_this.applyStreamLatencyProfile(data === null || data === void 0 ? void 0 : data.details);
|
|
3503
3512
|
if (_this.inAdBreak || _this.pendingAdBreak) {
|
|
3504
3513
|
return;
|
|
3505
3514
|
}
|
|
@@ -3779,6 +3788,64 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3779
3788
|
}).call(this);
|
|
3780
3789
|
}
|
|
3781
3790
|
},
|
|
3791
|
+
{
|
|
3792
|
+
key: "applyStreamLatencyProfile",
|
|
3793
|
+
value: function applyStreamLatencyProfile(details) {
|
|
3794
|
+
if (this.latencyProfileApplied || !this.hls) {
|
|
3795
|
+
return;
|
|
3796
|
+
}
|
|
3797
|
+
if (!details) {
|
|
3798
|
+
return;
|
|
3799
|
+
}
|
|
3800
|
+
if (details.live !== true) {
|
|
3801
|
+
this.latencyProfileApplied = true;
|
|
3802
|
+
this.detectedLowLatencyStream = false;
|
|
3803
|
+
return;
|
|
3804
|
+
}
|
|
3805
|
+
var isLowLatencyManifest = this.isLowLatencyManifest(details);
|
|
3806
|
+
var useLowLatency = isLowLatencyManifest && !!this.config.lowLatencyMode;
|
|
3807
|
+
this.detectedLowLatencyStream = useLowLatency;
|
|
3808
|
+
this.latencyProfileApplied = true;
|
|
3809
|
+
var cfg = this.hls.config;
|
|
3810
|
+
if (useLowLatency) {
|
|
3811
|
+
cfg.maxLiveSyncPlaybackRate = 1.5;
|
|
3812
|
+
cfg.maxBufferHole = 0.5;
|
|
3813
|
+
delete cfg.liveSyncDuration;
|
|
3814
|
+
} else {
|
|
3815
|
+
cfg.maxLiveSyncPlaybackRate = 1.1;
|
|
3816
|
+
cfg.maxBufferHole = 1;
|
|
3817
|
+
delete cfg.liveSyncDuration;
|
|
3818
|
+
cfg.liveSyncDurationCount = 3;
|
|
3819
|
+
}
|
|
3820
|
+
if (this.config.debugAdTiming) {
|
|
3821
|
+
var _details_targetduration;
|
|
3822
|
+
console.log("[StormcloudVideoPlayer] Live latency profile: ".concat(useLowLatency ? "LL-HLS (low latency)" : "standard live (stability)"), {
|
|
3823
|
+
isLowLatencyManifest: isLowLatencyManifest,
|
|
3824
|
+
lowLatencyModeRequested: !!this.config.lowLatencyMode,
|
|
3825
|
+
canBlockReload: details.canBlockReload,
|
|
3826
|
+
partTarget: details.partTarget,
|
|
3827
|
+
partHoldBack: details.partHoldBack,
|
|
3828
|
+
partListLength: Array.isArray(details.partList) ? details.partList.length : 0,
|
|
3829
|
+
targetDuration: (_details_targetduration = details.targetduration) !== null && _details_targetduration !== void 0 ? _details_targetduration : details.targetDuration,
|
|
3830
|
+
maxLiveSyncPlaybackRate: cfg.maxLiveSyncPlaybackRate,
|
|
3831
|
+
maxBufferHole: cfg.maxBufferHole
|
|
3832
|
+
});
|
|
3833
|
+
}
|
|
3834
|
+
}
|
|
3835
|
+
},
|
|
3836
|
+
{
|
|
3837
|
+
key: "isLowLatencyManifest",
|
|
3838
|
+
value: function isLowLatencyManifest(details) {
|
|
3839
|
+
if (!details) {
|
|
3840
|
+
return false;
|
|
3841
|
+
}
|
|
3842
|
+
var hasParts = Array.isArray(details.partList) && details.partList.length > 0;
|
|
3843
|
+
var hasPartTarget = typeof details.partTarget === "number" && details.partTarget > 0;
|
|
3844
|
+
var hasPartHoldBack = typeof details.partHoldBack === "number" && details.partHoldBack > 0;
|
|
3845
|
+
var canBlockReload = details.canBlockReload === true;
|
|
3846
|
+
return hasParts || hasPartTarget || hasPartHoldBack || canBlockReload;
|
|
3847
|
+
}
|
|
3848
|
+
},
|
|
3782
3849
|
{
|
|
3783
3850
|
key: "attachImaEventListeners",
|
|
3784
3851
|
value: function attachImaEventListeners() {
|
|
@@ -5767,6 +5834,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5767
5834
|
return !!(this.config.allowNativeHls && !((_this_config_showCustomControls = this.config.showCustomControls) !== null && _this_config_showCustomControls !== void 0 ? _this_config_showCustomControls : false));
|
|
5768
5835
|
}
|
|
5769
5836
|
},
|
|
5837
|
+
{
|
|
5838
|
+
key: "isLowLatencyStream",
|
|
5839
|
+
value: function isLowLatencyStream() {
|
|
5840
|
+
return this.detectedLowLatencyStream;
|
|
5841
|
+
}
|
|
5842
|
+
},
|
|
5770
5843
|
{
|
|
5771
5844
|
key: "shouldContinueLiveStreamDuringAds",
|
|
5772
5845
|
value: function shouldContinueLiveStreamDuringAds() {
|