stormcloud-video-player 0.8.53 → 0.8.54
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 +80 -9
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +80 -9
- package/lib/index.js.map +1 -1
- package/lib/player/HlsEngine.cjs +74 -9
- package/lib/player/HlsEngine.cjs.map +1 -1
- package/lib/player/HlsEngine.d.cts +5 -0
- package/lib/player/StormcloudVideoPlayer.cjs +80 -9
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +1 -0
- package/lib/players/HlsPlayer.cjs +80 -9
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +80 -9
- package/lib/players/index.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +80 -9
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/package.json +1 -1
package/lib/players/index.cjs
CHANGED
|
@@ -6527,6 +6527,7 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6527
6527
|
this.bufferedSegmentsCount = 0;
|
|
6528
6528
|
this.shouldAutoplayAfterBuffering = false;
|
|
6529
6529
|
this.hasInitialBufferCompleted = false;
|
|
6530
|
+
this.latencyProfileApplied = false;
|
|
6530
6531
|
this.config = config;
|
|
6531
6532
|
this.video = video;
|
|
6532
6533
|
this.cueManager = cueManager;
|
|
@@ -6595,24 +6596,21 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6595
6596
|
key: "setupHls",
|
|
6596
6597
|
value: function setupHls() {
|
|
6597
6598
|
var _this = this;
|
|
6598
|
-
this.hls = new import_hls2.default(
|
|
6599
|
+
this.hls = new import_hls2.default({
|
|
6599
6600
|
enableWorker: true,
|
|
6600
6601
|
backBufferLength: 30,
|
|
6601
6602
|
liveDurationInfinity: true,
|
|
6602
6603
|
lowLatencyMode: !!this.config.lowLatencyMode,
|
|
6603
|
-
maxLiveSyncPlaybackRate:
|
|
6604
|
-
}, this.config.lowLatencyMode ? {
|
|
6605
|
-
liveSyncDuration: 2
|
|
6606
|
-
} : {}), {
|
|
6604
|
+
maxLiveSyncPlaybackRate: 1.1,
|
|
6607
6605
|
maxBufferLength: 30,
|
|
6608
6606
|
maxMaxBufferLength: 600,
|
|
6609
6607
|
maxBufferSize: 60 * 1e3 * 1e3,
|
|
6610
|
-
maxBufferHole:
|
|
6608
|
+
maxBufferHole: 1,
|
|
6611
6609
|
highBufferWatchdogPeriod: 2,
|
|
6612
|
-
nudgeOffset: 0.
|
|
6613
|
-
nudgeMaxRetry:
|
|
6610
|
+
nudgeOffset: 0.2,
|
|
6611
|
+
nudgeMaxRetry: 5,
|
|
6614
6612
|
startPosition: -1
|
|
6615
|
-
})
|
|
6613
|
+
});
|
|
6616
6614
|
this.hls.on(import_hls2.default.Events.MEDIA_ATTACHED, function() {
|
|
6617
6615
|
var _this_hls;
|
|
6618
6616
|
(_this_hls = _this.hls) === null || _this_hls === void 0 ? void 0 : _this_hls.loadSource(_this.config.src);
|
|
@@ -6636,6 +6634,8 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6636
6634
|
this.bufferedSegmentsCount = 0;
|
|
6637
6635
|
this.hasInitialBufferCompleted = false;
|
|
6638
6636
|
this.shouldAutoplayAfterBuffering = !!this.config.autoplay;
|
|
6637
|
+
this.latencyProfileApplied = false;
|
|
6638
|
+
this.detectedLowLatencyStream = void 0;
|
|
6639
6639
|
minSegments = (_this_config_minSegmentsBeforePlay = this.config.minSegmentsBeforePlay) !== null && _this_config_minSegmentsBeforePlay !== void 0 ? _this_config_minSegmentsBeforePlay : 2;
|
|
6640
6640
|
if (this.debug) {
|
|
6641
6641
|
console.log("[StormcloudVideoPlayer] Waiting for", minSegments, "segments to buffer before playback");
|
|
@@ -6666,6 +6666,7 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6666
6666
|
}).call(_this);
|
|
6667
6667
|
});
|
|
6668
6668
|
this.hls.on(import_hls2.default.Events.LEVEL_LOADED, function(_evt, data) {
|
|
6669
|
+
_this.applyStreamLatencyProfile(data === null || data === void 0 ? void 0 : data.details);
|
|
6669
6670
|
if (_this.callbacks.isInAdBreak() || _this.callbacks.hasPendingAdBreak()) {
|
|
6670
6671
|
return;
|
|
6671
6672
|
}
|
|
@@ -6939,6 +6940,70 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6939
6940
|
this.hls.attachMedia(this.video);
|
|
6940
6941
|
}
|
|
6941
6942
|
},
|
|
6943
|
+
{
|
|
6944
|
+
key: "isLowLatencyStream",
|
|
6945
|
+
value: function isLowLatencyStream() {
|
|
6946
|
+
return this.detectedLowLatencyStream;
|
|
6947
|
+
}
|
|
6948
|
+
},
|
|
6949
|
+
{
|
|
6950
|
+
key: "applyStreamLatencyProfile",
|
|
6951
|
+
value: function applyStreamLatencyProfile(details) {
|
|
6952
|
+
if (this.latencyProfileApplied || !this.hls) {
|
|
6953
|
+
return;
|
|
6954
|
+
}
|
|
6955
|
+
if (!details) {
|
|
6956
|
+
return;
|
|
6957
|
+
}
|
|
6958
|
+
if (details.live !== true) {
|
|
6959
|
+
this.latencyProfileApplied = true;
|
|
6960
|
+
this.detectedLowLatencyStream = false;
|
|
6961
|
+
return;
|
|
6962
|
+
}
|
|
6963
|
+
var isLowLatencyManifest = this.isLowLatencyManifest(details);
|
|
6964
|
+
var useLowLatency = isLowLatencyManifest && !!this.config.lowLatencyMode;
|
|
6965
|
+
this.detectedLowLatencyStream = useLowLatency;
|
|
6966
|
+
this.latencyProfileApplied = true;
|
|
6967
|
+
var cfg = this.hls.config;
|
|
6968
|
+
if (useLowLatency) {
|
|
6969
|
+
cfg.maxLiveSyncPlaybackRate = 1.5;
|
|
6970
|
+
cfg.maxBufferHole = 0.5;
|
|
6971
|
+
delete cfg.liveSyncDuration;
|
|
6972
|
+
} else {
|
|
6973
|
+
cfg.maxLiveSyncPlaybackRate = 1.1;
|
|
6974
|
+
cfg.maxBufferHole = 1;
|
|
6975
|
+
delete cfg.liveSyncDuration;
|
|
6976
|
+
cfg.liveSyncDurationCount = 3;
|
|
6977
|
+
}
|
|
6978
|
+
if (this.debug) {
|
|
6979
|
+
var _details_targetduration;
|
|
6980
|
+
console.log("[StormcloudVideoPlayer] Live latency profile: ".concat(useLowLatency ? "LL-HLS (low latency)" : "standard live (stability)"), {
|
|
6981
|
+
isLowLatencyManifest: isLowLatencyManifest,
|
|
6982
|
+
lowLatencyModeRequested: !!this.config.lowLatencyMode,
|
|
6983
|
+
canBlockReload: details.canBlockReload,
|
|
6984
|
+
partTarget: details.partTarget,
|
|
6985
|
+
partHoldBack: details.partHoldBack,
|
|
6986
|
+
partListLength: Array.isArray(details.partList) ? details.partList.length : 0,
|
|
6987
|
+
targetDuration: (_details_targetduration = details.targetduration) !== null && _details_targetduration !== void 0 ? _details_targetduration : details.targetDuration,
|
|
6988
|
+
maxLiveSyncPlaybackRate: cfg.maxLiveSyncPlaybackRate,
|
|
6989
|
+
maxBufferHole: cfg.maxBufferHole
|
|
6990
|
+
});
|
|
6991
|
+
}
|
|
6992
|
+
}
|
|
6993
|
+
},
|
|
6994
|
+
{
|
|
6995
|
+
key: "isLowLatencyManifest",
|
|
6996
|
+
value: function isLowLatencyManifest(details) {
|
|
6997
|
+
if (!details) {
|
|
6998
|
+
return false;
|
|
6999
|
+
}
|
|
7000
|
+
var hasParts = Array.isArray(details.partList) && details.partList.length > 0;
|
|
7001
|
+
var hasPartTarget = typeof details.partTarget === "number" && details.partTarget > 0;
|
|
7002
|
+
var hasPartHoldBack = typeof details.partHoldBack === "number" && details.partHoldBack > 0;
|
|
7003
|
+
var canBlockReload = details.canBlockReload === true;
|
|
7004
|
+
return hasParts || hasPartTarget || hasPartHoldBack || canBlockReload;
|
|
7005
|
+
}
|
|
7006
|
+
},
|
|
6942
7007
|
{
|
|
6943
7008
|
key: "onId3Tag",
|
|
6944
7009
|
value: function onId3Tag(tag) {
|
|
@@ -9424,6 +9489,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
9424
9489
|
return this.hlsEngine.isLiveStream;
|
|
9425
9490
|
}
|
|
9426
9491
|
},
|
|
9492
|
+
{
|
|
9493
|
+
key: "isLowLatencyStream",
|
|
9494
|
+
value: function isLowLatencyStream() {
|
|
9495
|
+
return this.hlsEngine.isLowLatencyStream();
|
|
9496
|
+
}
|
|
9497
|
+
},
|
|
9427
9498
|
{
|
|
9428
9499
|
key: "videoElement",
|
|
9429
9500
|
get: function get() {
|