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
|
@@ -39,6 +39,7 @@ declare class StormcloudVideoPlayer {
|
|
|
39
39
|
getStreamType(): "hls" | "other";
|
|
40
40
|
shouldShowNativeControls(): boolean;
|
|
41
41
|
isLive(): boolean;
|
|
42
|
+
isLowLatencyStream(): boolean | undefined;
|
|
42
43
|
get videoElement(): HTMLVideoElement;
|
|
43
44
|
toggleMute(): void;
|
|
44
45
|
toggleFullscreen(): Promise<void>;
|
|
@@ -6491,6 +6491,7 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6491
6491
|
this.bufferedSegmentsCount = 0;
|
|
6492
6492
|
this.shouldAutoplayAfterBuffering = false;
|
|
6493
6493
|
this.hasInitialBufferCompleted = false;
|
|
6494
|
+
this.latencyProfileApplied = false;
|
|
6494
6495
|
this.config = config;
|
|
6495
6496
|
this.video = video;
|
|
6496
6497
|
this.cueManager = cueManager;
|
|
@@ -6559,24 +6560,21 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6559
6560
|
key: "setupHls",
|
|
6560
6561
|
value: function setupHls() {
|
|
6561
6562
|
var _this = this;
|
|
6562
|
-
this.hls = new import_hls2.default(
|
|
6563
|
+
this.hls = new import_hls2.default({
|
|
6563
6564
|
enableWorker: true,
|
|
6564
6565
|
backBufferLength: 30,
|
|
6565
6566
|
liveDurationInfinity: true,
|
|
6566
6567
|
lowLatencyMode: !!this.config.lowLatencyMode,
|
|
6567
|
-
maxLiveSyncPlaybackRate:
|
|
6568
|
-
}, this.config.lowLatencyMode ? {
|
|
6569
|
-
liveSyncDuration: 2
|
|
6570
|
-
} : {}), {
|
|
6568
|
+
maxLiveSyncPlaybackRate: 1.1,
|
|
6571
6569
|
maxBufferLength: 30,
|
|
6572
6570
|
maxMaxBufferLength: 600,
|
|
6573
6571
|
maxBufferSize: 60 * 1e3 * 1e3,
|
|
6574
|
-
maxBufferHole:
|
|
6572
|
+
maxBufferHole: 1,
|
|
6575
6573
|
highBufferWatchdogPeriod: 2,
|
|
6576
|
-
nudgeOffset: 0.
|
|
6577
|
-
nudgeMaxRetry:
|
|
6574
|
+
nudgeOffset: 0.2,
|
|
6575
|
+
nudgeMaxRetry: 5,
|
|
6578
6576
|
startPosition: -1
|
|
6579
|
-
})
|
|
6577
|
+
});
|
|
6580
6578
|
this.hls.on(import_hls2.default.Events.MEDIA_ATTACHED, function() {
|
|
6581
6579
|
var _this_hls;
|
|
6582
6580
|
(_this_hls = _this.hls) === null || _this_hls === void 0 ? void 0 : _this_hls.loadSource(_this.config.src);
|
|
@@ -6600,6 +6598,8 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6600
6598
|
this.bufferedSegmentsCount = 0;
|
|
6601
6599
|
this.hasInitialBufferCompleted = false;
|
|
6602
6600
|
this.shouldAutoplayAfterBuffering = !!this.config.autoplay;
|
|
6601
|
+
this.latencyProfileApplied = false;
|
|
6602
|
+
this.detectedLowLatencyStream = void 0;
|
|
6603
6603
|
minSegments = (_this_config_minSegmentsBeforePlay = this.config.minSegmentsBeforePlay) !== null && _this_config_minSegmentsBeforePlay !== void 0 ? _this_config_minSegmentsBeforePlay : 2;
|
|
6604
6604
|
if (this.debug) {
|
|
6605
6605
|
console.log("[StormcloudVideoPlayer] Waiting for", minSegments, "segments to buffer before playback");
|
|
@@ -6630,6 +6630,7 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6630
6630
|
}).call(_this);
|
|
6631
6631
|
});
|
|
6632
6632
|
this.hls.on(import_hls2.default.Events.LEVEL_LOADED, function(_evt, data) {
|
|
6633
|
+
_this.applyStreamLatencyProfile(data === null || data === void 0 ? void 0 : data.details);
|
|
6633
6634
|
if (_this.callbacks.isInAdBreak() || _this.callbacks.hasPendingAdBreak()) {
|
|
6634
6635
|
return;
|
|
6635
6636
|
}
|
|
@@ -6903,6 +6904,70 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6903
6904
|
this.hls.attachMedia(this.video);
|
|
6904
6905
|
}
|
|
6905
6906
|
},
|
|
6907
|
+
{
|
|
6908
|
+
key: "isLowLatencyStream",
|
|
6909
|
+
value: function isLowLatencyStream() {
|
|
6910
|
+
return this.detectedLowLatencyStream;
|
|
6911
|
+
}
|
|
6912
|
+
},
|
|
6913
|
+
{
|
|
6914
|
+
key: "applyStreamLatencyProfile",
|
|
6915
|
+
value: function applyStreamLatencyProfile(details) {
|
|
6916
|
+
if (this.latencyProfileApplied || !this.hls) {
|
|
6917
|
+
return;
|
|
6918
|
+
}
|
|
6919
|
+
if (!details) {
|
|
6920
|
+
return;
|
|
6921
|
+
}
|
|
6922
|
+
if (details.live !== true) {
|
|
6923
|
+
this.latencyProfileApplied = true;
|
|
6924
|
+
this.detectedLowLatencyStream = false;
|
|
6925
|
+
return;
|
|
6926
|
+
}
|
|
6927
|
+
var isLowLatencyManifest = this.isLowLatencyManifest(details);
|
|
6928
|
+
var useLowLatency = isLowLatencyManifest && !!this.config.lowLatencyMode;
|
|
6929
|
+
this.detectedLowLatencyStream = useLowLatency;
|
|
6930
|
+
this.latencyProfileApplied = true;
|
|
6931
|
+
var cfg = this.hls.config;
|
|
6932
|
+
if (useLowLatency) {
|
|
6933
|
+
cfg.maxLiveSyncPlaybackRate = 1.5;
|
|
6934
|
+
cfg.maxBufferHole = 0.5;
|
|
6935
|
+
delete cfg.liveSyncDuration;
|
|
6936
|
+
} else {
|
|
6937
|
+
cfg.maxLiveSyncPlaybackRate = 1.1;
|
|
6938
|
+
cfg.maxBufferHole = 1;
|
|
6939
|
+
delete cfg.liveSyncDuration;
|
|
6940
|
+
cfg.liveSyncDurationCount = 3;
|
|
6941
|
+
}
|
|
6942
|
+
if (this.debug) {
|
|
6943
|
+
var _details_targetduration;
|
|
6944
|
+
console.log("[StormcloudVideoPlayer] Live latency profile: ".concat(useLowLatency ? "LL-HLS (low latency)" : "standard live (stability)"), {
|
|
6945
|
+
isLowLatencyManifest: isLowLatencyManifest,
|
|
6946
|
+
lowLatencyModeRequested: !!this.config.lowLatencyMode,
|
|
6947
|
+
canBlockReload: details.canBlockReload,
|
|
6948
|
+
partTarget: details.partTarget,
|
|
6949
|
+
partHoldBack: details.partHoldBack,
|
|
6950
|
+
partListLength: Array.isArray(details.partList) ? details.partList.length : 0,
|
|
6951
|
+
targetDuration: (_details_targetduration = details.targetduration) !== null && _details_targetduration !== void 0 ? _details_targetduration : details.targetDuration,
|
|
6952
|
+
maxLiveSyncPlaybackRate: cfg.maxLiveSyncPlaybackRate,
|
|
6953
|
+
maxBufferHole: cfg.maxBufferHole
|
|
6954
|
+
});
|
|
6955
|
+
}
|
|
6956
|
+
}
|
|
6957
|
+
},
|
|
6958
|
+
{
|
|
6959
|
+
key: "isLowLatencyManifest",
|
|
6960
|
+
value: function isLowLatencyManifest(details) {
|
|
6961
|
+
if (!details) {
|
|
6962
|
+
return false;
|
|
6963
|
+
}
|
|
6964
|
+
var hasParts = Array.isArray(details.partList) && details.partList.length > 0;
|
|
6965
|
+
var hasPartTarget = typeof details.partTarget === "number" && details.partTarget > 0;
|
|
6966
|
+
var hasPartHoldBack = typeof details.partHoldBack === "number" && details.partHoldBack > 0;
|
|
6967
|
+
var canBlockReload = details.canBlockReload === true;
|
|
6968
|
+
return hasParts || hasPartTarget || hasPartHoldBack || canBlockReload;
|
|
6969
|
+
}
|
|
6970
|
+
},
|
|
6906
6971
|
{
|
|
6907
6972
|
key: "onId3Tag",
|
|
6908
6973
|
value: function onId3Tag(tag) {
|
|
@@ -9388,6 +9453,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
9388
9453
|
return this.hlsEngine.isLiveStream;
|
|
9389
9454
|
}
|
|
9390
9455
|
},
|
|
9456
|
+
{
|
|
9457
|
+
key: "isLowLatencyStream",
|
|
9458
|
+
value: function isLowLatencyStream() {
|
|
9459
|
+
return this.hlsEngine.isLowLatencyStream();
|
|
9460
|
+
}
|
|
9461
|
+
},
|
|
9391
9462
|
{
|
|
9392
9463
|
key: "videoElement",
|
|
9393
9464
|
get: function get() {
|