@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.
package/dist/index.js CHANGED
@@ -2292,12 +2292,14 @@ function Video({
2292
2292
  if (Hls.isSupported()) {
2293
2293
  const hls = new Hls({
2294
2294
  enableWorker: true,
2295
- maxBufferLength: 30,
2296
- maxMaxBufferLength: 120,
2297
- maxBufferSize: 120 * 1e3 * 1e3,
2298
- backBufferLength: 30,
2295
+ // Buffer ~20s ahead (≈1/6 of a 2min video). maxMaxBufferLength caps the
2296
+ // absolute ceiling so HLS.js doesn't buffer the entire file on fast connections.
2297
+ maxBufferLength: 20,
2298
+ maxMaxBufferLength: 30,
2299
+ maxBufferSize: 40 * 1e3 * 1e3,
2300
+ // Keep only 10s of back-buffer for seeking — avoids holding GB of 4K data
2301
+ backBufferLength: 10,
2299
2302
  maxBufferHole: 0.5,
2300
- // Be patient with large 4K/HDR fragments before declaring a stall
2301
2303
  highBufferWatchdogPeriod: 5,
2302
2304
  nudgeOffset: 0.2,
2303
2305
  nudgeMaxRetry: 3,
@@ -2356,6 +2358,9 @@ function Video({
2356
2358
  });
2357
2359
  hls.on(Hls.Events.LEVEL_SWITCHED, (_, data) => {
2358
2360
  console.debug("[Silo/hls] LEVEL_SWITCHED", data.level);
2361
+ if (pinnedLevel >= 0 && data.level === pinnedLevel) {
2362
+ hls.currentLevel = pinnedLevel;
2363
+ }
2359
2364
  if (pinnedAudio >= 0 && hls.audioTrack !== pinnedAudio) {
2360
2365
  hls.audioTrack = pinnedAudio;
2361
2366
  }
@@ -2586,7 +2591,7 @@ function Video({
2586
2591
  }
2587
2592
  if (option.type === "hls" && hlsRef.current && option.index != null) {
2588
2593
  hlsRef.current.__pinLevel?.(option.index);
2589
- hlsRef.current.currentLevel = option.index;
2594
+ hlsRef.current.nextLevel = option.index;
2590
2595
  return;
2591
2596
  }
2592
2597
  if (option.type === "dash" && dashRef.current && option.index != null) {