@geekapps/silo-elements-nextjs 0.3.16 → 0.3.17

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.
@@ -762,12 +762,14 @@ function Video({
762
762
  if (Hls.isSupported()) {
763
763
  const hls = new Hls({
764
764
  enableWorker: true,
765
- maxBufferLength: 30,
766
- maxMaxBufferLength: 120,
767
- maxBufferSize: 120 * 1e3 * 1e3,
768
- backBufferLength: 30,
765
+ // Buffer ~20s ahead (≈1/6 of a 2min video). maxMaxBufferLength caps the
766
+ // absolute ceiling so HLS.js doesn't buffer the entire file on fast connections.
767
+ maxBufferLength: 20,
768
+ maxMaxBufferLength: 30,
769
+ maxBufferSize: 40 * 1e3 * 1e3,
770
+ // Keep only 10s of back-buffer for seeking — avoids holding GB of 4K data
771
+ backBufferLength: 10,
769
772
  maxBufferHole: 0.5,
770
- // Be patient with large 4K/HDR fragments before declaring a stall
771
773
  highBufferWatchdogPeriod: 5,
772
774
  nudgeOffset: 0.2,
773
775
  nudgeMaxRetry: 3,
@@ -826,6 +828,9 @@ function Video({
826
828
  });
827
829
  hls.on(Hls.Events.LEVEL_SWITCHED, (_, data) => {
828
830
  console.debug("[Silo/hls] LEVEL_SWITCHED", data.level);
831
+ if (pinnedLevel >= 0 && data.level === pinnedLevel) {
832
+ hls.currentLevel = pinnedLevel;
833
+ }
829
834
  if (pinnedAudio >= 0 && hls.audioTrack !== pinnedAudio) {
830
835
  hls.audioTrack = pinnedAudio;
831
836
  }
@@ -1056,7 +1061,7 @@ function Video({
1056
1061
  }
1057
1062
  if (option.type === "hls" && hlsRef.current && option.index != null) {
1058
1063
  hlsRef.current.__pinLevel?.(option.index);
1059
- hlsRef.current.currentLevel = option.index;
1064
+ hlsRef.current.nextLevel = option.index;
1060
1065
  return;
1061
1066
  }
1062
1067
  if (option.type === "dash" && dashRef.current && option.index != null) {