@geekapps/silo-elements-nextjs 0.3.11 → 0.3.12

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,9 +2292,15 @@ function Video({
2292
2292
  if (Hls.isSupported()) {
2293
2293
  const hls = new Hls({
2294
2294
  enableWorker: true,
2295
- maxBufferLength: 10,
2296
- maxMaxBufferLength: 20,
2297
- maxBufferSize: 20 * 1e3 * 1e3
2295
+ maxBufferLength: 30,
2296
+ maxMaxBufferLength: 60,
2297
+ maxBufferSize: 60 * 1e3 * 1e3,
2298
+ backBufferLength: 30,
2299
+ maxBufferHole: 0.5,
2300
+ nudgeMaxRetry: 6,
2301
+ startLevel: -1,
2302
+ abrBandWidthFactor: 0.95,
2303
+ abrBandWidthUpFactor: 0.7
2298
2304
  });
2299
2305
  hlsRef.current = hls;
2300
2306
  console.debug("[Silo/hls] loadSource", activeSource.src);
@@ -2350,11 +2356,29 @@ function Video({
2350
2356
  console.debug("[Silo/hls] FRAG_LOADED", data.frag?.type, data.frag?.sn);
2351
2357
  });
2352
2358
  let mediaErrorAttempts = 0;
2359
+ let audioAppendErrors = 0;
2353
2360
  hls.on(Hls.Events.ERROR, (_, data) => {
2354
2361
  const fragUrl = (data.frag?.url ?? data.url ?? "").slice(-80);
2355
2362
  const fragType = data.frag?.type ?? "?";
2356
2363
  console.debug("[Silo/hls] ERROR fatal=", data.fatal, "type=", data.type, "details=", data.details, "fragType=", fragType, "url=", fragUrl);
2357
- if (!data.fatal) return;
2364
+ if (!data.fatal) {
2365
+ const isAudioBufError = fragType === "audio" && (data.details === Hls.ErrorDetails.BUFFER_APPEND_ERROR || data.details === Hls.ErrorDetails.BUFFER_APPENDING_ERROR);
2366
+ if (isAudioBufError) {
2367
+ audioAppendErrors += 1;
2368
+ if (audioAppendErrors >= 3) {
2369
+ console.warn("[Silo/hls] repeated audio buffer errors \u2014 disabling separate audio tracks");
2370
+ setAudioTracks([]);
2371
+ try {
2372
+ hls.audioTrack = -1;
2373
+ } catch {
2374
+ }
2375
+ audioAppendErrors = 0;
2376
+ }
2377
+ } else {
2378
+ audioAppendErrors = 0;
2379
+ }
2380
+ return;
2381
+ }
2358
2382
  if (data.details === Hls.ErrorDetails.FRAG_PARSING_ERROR && fragType === "audio") {
2359
2383
  console.warn("[Silo/hls] audio frag parse failed \u2014 disabling separate audio tracks and retrying");
2360
2384
  setAudioTracks([]);
@@ -2522,7 +2546,7 @@ function Video({
2522
2546
  return;
2523
2547
  }
2524
2548
  if (option.type === "hls" && hlsRef.current && option.index != null) {
2525
- hlsRef.current.currentLevel = option.index;
2549
+ hlsRef.current.nextLevel = option.index;
2526
2550
  return;
2527
2551
  }
2528
2552
  if (option.type === "dash" && dashRef.current && option.index != null) {