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/index.cjs
CHANGED
|
@@ -6725,6 +6725,7 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6725
6725
|
this.bufferedSegmentsCount = 0;
|
|
6726
6726
|
this.shouldAutoplayAfterBuffering = false;
|
|
6727
6727
|
this.hasInitialBufferCompleted = false;
|
|
6728
|
+
this.latencyProfileApplied = false;
|
|
6728
6729
|
this.config = config;
|
|
6729
6730
|
this.video = video;
|
|
6730
6731
|
this.cueManager = cueManager;
|
|
@@ -6793,24 +6794,21 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6793
6794
|
key: "setupHls",
|
|
6794
6795
|
value: function setupHls() {
|
|
6795
6796
|
var _this = this;
|
|
6796
|
-
this.hls = new import_hls2.default(
|
|
6797
|
+
this.hls = new import_hls2.default({
|
|
6797
6798
|
enableWorker: true,
|
|
6798
6799
|
backBufferLength: 30,
|
|
6799
6800
|
liveDurationInfinity: true,
|
|
6800
6801
|
lowLatencyMode: !!this.config.lowLatencyMode,
|
|
6801
|
-
maxLiveSyncPlaybackRate:
|
|
6802
|
-
}, this.config.lowLatencyMode ? {
|
|
6803
|
-
liveSyncDuration: 2
|
|
6804
|
-
} : {}), {
|
|
6802
|
+
maxLiveSyncPlaybackRate: 1.1,
|
|
6805
6803
|
maxBufferLength: 30,
|
|
6806
6804
|
maxMaxBufferLength: 600,
|
|
6807
6805
|
maxBufferSize: 60 * 1e3 * 1e3,
|
|
6808
|
-
maxBufferHole:
|
|
6806
|
+
maxBufferHole: 1,
|
|
6809
6807
|
highBufferWatchdogPeriod: 2,
|
|
6810
|
-
nudgeOffset: 0.
|
|
6811
|
-
nudgeMaxRetry:
|
|
6808
|
+
nudgeOffset: 0.2,
|
|
6809
|
+
nudgeMaxRetry: 5,
|
|
6812
6810
|
startPosition: -1
|
|
6813
|
-
})
|
|
6811
|
+
});
|
|
6814
6812
|
this.hls.on(import_hls2.default.Events.MEDIA_ATTACHED, function() {
|
|
6815
6813
|
var _this_hls;
|
|
6816
6814
|
(_this_hls = _this.hls) === null || _this_hls === void 0 ? void 0 : _this_hls.loadSource(_this.config.src);
|
|
@@ -6834,6 +6832,8 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6834
6832
|
this.bufferedSegmentsCount = 0;
|
|
6835
6833
|
this.hasInitialBufferCompleted = false;
|
|
6836
6834
|
this.shouldAutoplayAfterBuffering = !!this.config.autoplay;
|
|
6835
|
+
this.latencyProfileApplied = false;
|
|
6836
|
+
this.detectedLowLatencyStream = void 0;
|
|
6837
6837
|
minSegments = (_this_config_minSegmentsBeforePlay = this.config.minSegmentsBeforePlay) !== null && _this_config_minSegmentsBeforePlay !== void 0 ? _this_config_minSegmentsBeforePlay : 2;
|
|
6838
6838
|
if (this.debug) {
|
|
6839
6839
|
console.log("[StormcloudVideoPlayer] Waiting for", minSegments, "segments to buffer before playback");
|
|
@@ -6864,6 +6864,7 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6864
6864
|
}).call(_this);
|
|
6865
6865
|
});
|
|
6866
6866
|
this.hls.on(import_hls2.default.Events.LEVEL_LOADED, function(_evt, data) {
|
|
6867
|
+
_this.applyStreamLatencyProfile(data === null || data === void 0 ? void 0 : data.details);
|
|
6867
6868
|
if (_this.callbacks.isInAdBreak() || _this.callbacks.hasPendingAdBreak()) {
|
|
6868
6869
|
return;
|
|
6869
6870
|
}
|
|
@@ -7137,6 +7138,70 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
7137
7138
|
this.hls.attachMedia(this.video);
|
|
7138
7139
|
}
|
|
7139
7140
|
},
|
|
7141
|
+
{
|
|
7142
|
+
key: "isLowLatencyStream",
|
|
7143
|
+
value: function isLowLatencyStream() {
|
|
7144
|
+
return this.detectedLowLatencyStream;
|
|
7145
|
+
}
|
|
7146
|
+
},
|
|
7147
|
+
{
|
|
7148
|
+
key: "applyStreamLatencyProfile",
|
|
7149
|
+
value: function applyStreamLatencyProfile(details) {
|
|
7150
|
+
if (this.latencyProfileApplied || !this.hls) {
|
|
7151
|
+
return;
|
|
7152
|
+
}
|
|
7153
|
+
if (!details) {
|
|
7154
|
+
return;
|
|
7155
|
+
}
|
|
7156
|
+
if (details.live !== true) {
|
|
7157
|
+
this.latencyProfileApplied = true;
|
|
7158
|
+
this.detectedLowLatencyStream = false;
|
|
7159
|
+
return;
|
|
7160
|
+
}
|
|
7161
|
+
var isLowLatencyManifest = this.isLowLatencyManifest(details);
|
|
7162
|
+
var useLowLatency = isLowLatencyManifest && !!this.config.lowLatencyMode;
|
|
7163
|
+
this.detectedLowLatencyStream = useLowLatency;
|
|
7164
|
+
this.latencyProfileApplied = true;
|
|
7165
|
+
var cfg = this.hls.config;
|
|
7166
|
+
if (useLowLatency) {
|
|
7167
|
+
cfg.maxLiveSyncPlaybackRate = 1.5;
|
|
7168
|
+
cfg.maxBufferHole = 0.5;
|
|
7169
|
+
delete cfg.liveSyncDuration;
|
|
7170
|
+
} else {
|
|
7171
|
+
cfg.maxLiveSyncPlaybackRate = 1.1;
|
|
7172
|
+
cfg.maxBufferHole = 1;
|
|
7173
|
+
delete cfg.liveSyncDuration;
|
|
7174
|
+
cfg.liveSyncDurationCount = 3;
|
|
7175
|
+
}
|
|
7176
|
+
if (this.debug) {
|
|
7177
|
+
var _details_targetduration;
|
|
7178
|
+
console.log("[StormcloudVideoPlayer] Live latency profile: ".concat(useLowLatency ? "LL-HLS (low latency)" : "standard live (stability)"), {
|
|
7179
|
+
isLowLatencyManifest: isLowLatencyManifest,
|
|
7180
|
+
lowLatencyModeRequested: !!this.config.lowLatencyMode,
|
|
7181
|
+
canBlockReload: details.canBlockReload,
|
|
7182
|
+
partTarget: details.partTarget,
|
|
7183
|
+
partHoldBack: details.partHoldBack,
|
|
7184
|
+
partListLength: Array.isArray(details.partList) ? details.partList.length : 0,
|
|
7185
|
+
targetDuration: (_details_targetduration = details.targetduration) !== null && _details_targetduration !== void 0 ? _details_targetduration : details.targetDuration,
|
|
7186
|
+
maxLiveSyncPlaybackRate: cfg.maxLiveSyncPlaybackRate,
|
|
7187
|
+
maxBufferHole: cfg.maxBufferHole
|
|
7188
|
+
});
|
|
7189
|
+
}
|
|
7190
|
+
}
|
|
7191
|
+
},
|
|
7192
|
+
{
|
|
7193
|
+
key: "isLowLatencyManifest",
|
|
7194
|
+
value: function isLowLatencyManifest(details) {
|
|
7195
|
+
if (!details) {
|
|
7196
|
+
return false;
|
|
7197
|
+
}
|
|
7198
|
+
var hasParts = Array.isArray(details.partList) && details.partList.length > 0;
|
|
7199
|
+
var hasPartTarget = typeof details.partTarget === "number" && details.partTarget > 0;
|
|
7200
|
+
var hasPartHoldBack = typeof details.partHoldBack === "number" && details.partHoldBack > 0;
|
|
7201
|
+
var canBlockReload = details.canBlockReload === true;
|
|
7202
|
+
return hasParts || hasPartTarget || hasPartHoldBack || canBlockReload;
|
|
7203
|
+
}
|
|
7204
|
+
},
|
|
7140
7205
|
{
|
|
7141
7206
|
key: "onId3Tag",
|
|
7142
7207
|
value: function onId3Tag(tag) {
|
|
@@ -9622,6 +9687,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
9622
9687
|
return this.hlsEngine.isLiveStream;
|
|
9623
9688
|
}
|
|
9624
9689
|
},
|
|
9690
|
+
{
|
|
9691
|
+
key: "isLowLatencyStream",
|
|
9692
|
+
value: function isLowLatencyStream() {
|
|
9693
|
+
return this.hlsEngine.isLowLatencyStream();
|
|
9694
|
+
}
|
|
9695
|
+
},
|
|
9625
9696
|
{
|
|
9626
9697
|
key: "videoElement",
|
|
9627
9698
|
get: function get() {
|