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.d.cts
CHANGED
|
@@ -207,6 +207,7 @@ declare class StormcloudVideoPlayer {
|
|
|
207
207
|
getStreamType(): "hls" | "other";
|
|
208
208
|
shouldShowNativeControls(): boolean;
|
|
209
209
|
isLive(): boolean;
|
|
210
|
+
isLowLatencyStream(): boolean | undefined;
|
|
210
211
|
get videoElement(): HTMLVideoElement;
|
|
211
212
|
toggleMute(): void;
|
|
212
213
|
toggleFullscreen(): Promise<void>;
|
package/lib/index.d.ts
CHANGED
|
@@ -207,6 +207,7 @@ declare class StormcloudVideoPlayer {
|
|
|
207
207
|
getStreamType(): "hls" | "other";
|
|
208
208
|
shouldShowNativeControls(): boolean;
|
|
209
209
|
isLive(): boolean;
|
|
210
|
+
isLowLatencyStream(): boolean | undefined;
|
|
210
211
|
get videoElement(): HTMLVideoElement;
|
|
211
212
|
toggleMute(): void;
|
|
212
213
|
toggleFullscreen(): Promise<void>;
|
package/lib/index.js
CHANGED
|
@@ -6513,6 +6513,7 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6513
6513
|
this.bufferedSegmentsCount = 0;
|
|
6514
6514
|
this.shouldAutoplayAfterBuffering = false;
|
|
6515
6515
|
this.hasInitialBufferCompleted = false;
|
|
6516
|
+
this.latencyProfileApplied = false;
|
|
6516
6517
|
this.config = config;
|
|
6517
6518
|
this.video = video;
|
|
6518
6519
|
this.cueManager = cueManager;
|
|
@@ -6581,24 +6582,21 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6581
6582
|
key: "setupHls",
|
|
6582
6583
|
value: function setupHls() {
|
|
6583
6584
|
var _this = this;
|
|
6584
|
-
this.hls = new Hls2(
|
|
6585
|
+
this.hls = new Hls2({
|
|
6585
6586
|
enableWorker: true,
|
|
6586
6587
|
backBufferLength: 30,
|
|
6587
6588
|
liveDurationInfinity: true,
|
|
6588
6589
|
lowLatencyMode: !!this.config.lowLatencyMode,
|
|
6589
|
-
maxLiveSyncPlaybackRate:
|
|
6590
|
-
}, this.config.lowLatencyMode ? {
|
|
6591
|
-
liveSyncDuration: 2
|
|
6592
|
-
} : {}), {
|
|
6590
|
+
maxLiveSyncPlaybackRate: 1.1,
|
|
6593
6591
|
maxBufferLength: 30,
|
|
6594
6592
|
maxMaxBufferLength: 600,
|
|
6595
6593
|
maxBufferSize: 60 * 1e3 * 1e3,
|
|
6596
|
-
maxBufferHole:
|
|
6594
|
+
maxBufferHole: 1,
|
|
6597
6595
|
highBufferWatchdogPeriod: 2,
|
|
6598
|
-
nudgeOffset: 0.
|
|
6599
|
-
nudgeMaxRetry:
|
|
6596
|
+
nudgeOffset: 0.2,
|
|
6597
|
+
nudgeMaxRetry: 5,
|
|
6600
6598
|
startPosition: -1
|
|
6601
|
-
})
|
|
6599
|
+
});
|
|
6602
6600
|
this.hls.on(Hls2.Events.MEDIA_ATTACHED, function() {
|
|
6603
6601
|
var _this_hls;
|
|
6604
6602
|
(_this_hls = _this.hls) === null || _this_hls === void 0 ? void 0 : _this_hls.loadSource(_this.config.src);
|
|
@@ -6622,6 +6620,8 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6622
6620
|
this.bufferedSegmentsCount = 0;
|
|
6623
6621
|
this.hasInitialBufferCompleted = false;
|
|
6624
6622
|
this.shouldAutoplayAfterBuffering = !!this.config.autoplay;
|
|
6623
|
+
this.latencyProfileApplied = false;
|
|
6624
|
+
this.detectedLowLatencyStream = void 0;
|
|
6625
6625
|
minSegments = (_this_config_minSegmentsBeforePlay = this.config.minSegmentsBeforePlay) !== null && _this_config_minSegmentsBeforePlay !== void 0 ? _this_config_minSegmentsBeforePlay : 2;
|
|
6626
6626
|
if (this.debug) {
|
|
6627
6627
|
console.log("[StormcloudVideoPlayer] Waiting for", minSegments, "segments to buffer before playback");
|
|
@@ -6652,6 +6652,7 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6652
6652
|
}).call(_this);
|
|
6653
6653
|
});
|
|
6654
6654
|
this.hls.on(Hls2.Events.LEVEL_LOADED, function(_evt, data) {
|
|
6655
|
+
_this.applyStreamLatencyProfile(data === null || data === void 0 ? void 0 : data.details);
|
|
6655
6656
|
if (_this.callbacks.isInAdBreak() || _this.callbacks.hasPendingAdBreak()) {
|
|
6656
6657
|
return;
|
|
6657
6658
|
}
|
|
@@ -6925,6 +6926,70 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6925
6926
|
this.hls.attachMedia(this.video);
|
|
6926
6927
|
}
|
|
6927
6928
|
},
|
|
6929
|
+
{
|
|
6930
|
+
key: "isLowLatencyStream",
|
|
6931
|
+
value: function isLowLatencyStream() {
|
|
6932
|
+
return this.detectedLowLatencyStream;
|
|
6933
|
+
}
|
|
6934
|
+
},
|
|
6935
|
+
{
|
|
6936
|
+
key: "applyStreamLatencyProfile",
|
|
6937
|
+
value: function applyStreamLatencyProfile(details) {
|
|
6938
|
+
if (this.latencyProfileApplied || !this.hls) {
|
|
6939
|
+
return;
|
|
6940
|
+
}
|
|
6941
|
+
if (!details) {
|
|
6942
|
+
return;
|
|
6943
|
+
}
|
|
6944
|
+
if (details.live !== true) {
|
|
6945
|
+
this.latencyProfileApplied = true;
|
|
6946
|
+
this.detectedLowLatencyStream = false;
|
|
6947
|
+
return;
|
|
6948
|
+
}
|
|
6949
|
+
var isLowLatencyManifest = this.isLowLatencyManifest(details);
|
|
6950
|
+
var useLowLatency = isLowLatencyManifest && !!this.config.lowLatencyMode;
|
|
6951
|
+
this.detectedLowLatencyStream = useLowLatency;
|
|
6952
|
+
this.latencyProfileApplied = true;
|
|
6953
|
+
var cfg = this.hls.config;
|
|
6954
|
+
if (useLowLatency) {
|
|
6955
|
+
cfg.maxLiveSyncPlaybackRate = 1.5;
|
|
6956
|
+
cfg.maxBufferHole = 0.5;
|
|
6957
|
+
delete cfg.liveSyncDuration;
|
|
6958
|
+
} else {
|
|
6959
|
+
cfg.maxLiveSyncPlaybackRate = 1.1;
|
|
6960
|
+
cfg.maxBufferHole = 1;
|
|
6961
|
+
delete cfg.liveSyncDuration;
|
|
6962
|
+
cfg.liveSyncDurationCount = 3;
|
|
6963
|
+
}
|
|
6964
|
+
if (this.debug) {
|
|
6965
|
+
var _details_targetduration;
|
|
6966
|
+
console.log("[StormcloudVideoPlayer] Live latency profile: ".concat(useLowLatency ? "LL-HLS (low latency)" : "standard live (stability)"), {
|
|
6967
|
+
isLowLatencyManifest: isLowLatencyManifest,
|
|
6968
|
+
lowLatencyModeRequested: !!this.config.lowLatencyMode,
|
|
6969
|
+
canBlockReload: details.canBlockReload,
|
|
6970
|
+
partTarget: details.partTarget,
|
|
6971
|
+
partHoldBack: details.partHoldBack,
|
|
6972
|
+
partListLength: Array.isArray(details.partList) ? details.partList.length : 0,
|
|
6973
|
+
targetDuration: (_details_targetduration = details.targetduration) !== null && _details_targetduration !== void 0 ? _details_targetduration : details.targetDuration,
|
|
6974
|
+
maxLiveSyncPlaybackRate: cfg.maxLiveSyncPlaybackRate,
|
|
6975
|
+
maxBufferHole: cfg.maxBufferHole
|
|
6976
|
+
});
|
|
6977
|
+
}
|
|
6978
|
+
}
|
|
6979
|
+
},
|
|
6980
|
+
{
|
|
6981
|
+
key: "isLowLatencyManifest",
|
|
6982
|
+
value: function isLowLatencyManifest(details) {
|
|
6983
|
+
if (!details) {
|
|
6984
|
+
return false;
|
|
6985
|
+
}
|
|
6986
|
+
var hasParts = Array.isArray(details.partList) && details.partList.length > 0;
|
|
6987
|
+
var hasPartTarget = typeof details.partTarget === "number" && details.partTarget > 0;
|
|
6988
|
+
var hasPartHoldBack = typeof details.partHoldBack === "number" && details.partHoldBack > 0;
|
|
6989
|
+
var canBlockReload = details.canBlockReload === true;
|
|
6990
|
+
return hasParts || hasPartTarget || hasPartHoldBack || canBlockReload;
|
|
6991
|
+
}
|
|
6992
|
+
},
|
|
6928
6993
|
{
|
|
6929
6994
|
key: "onId3Tag",
|
|
6930
6995
|
value: function onId3Tag(tag) {
|
|
@@ -9412,6 +9477,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
9412
9477
|
return this.hlsEngine.isLiveStream;
|
|
9413
9478
|
}
|
|
9414
9479
|
},
|
|
9480
|
+
{
|
|
9481
|
+
key: "isLowLatencyStream",
|
|
9482
|
+
value: function isLowLatencyStream() {
|
|
9483
|
+
return this.hlsEngine.isLowLatencyStream();
|
|
9484
|
+
}
|
|
9485
|
+
},
|
|
9415
9486
|
{
|
|
9416
9487
|
key: "videoElement",
|
|
9417
9488
|
get: function get() {
|