@geekapps/silo-elements-nextjs 0.3.14 → 0.3.16
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/VideoPlayer.js +22 -5
- package/dist/VideoPlayer.js.map +1 -1
- package/dist/index.js +22 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2293,14 +2293,18 @@ function Video({
|
|
|
2293
2293
|
const hls = new Hls({
|
|
2294
2294
|
enableWorker: true,
|
|
2295
2295
|
maxBufferLength: 30,
|
|
2296
|
-
maxMaxBufferLength:
|
|
2297
|
-
maxBufferSize:
|
|
2296
|
+
maxMaxBufferLength: 120,
|
|
2297
|
+
maxBufferSize: 120 * 1e3 * 1e3,
|
|
2298
2298
|
backBufferLength: 30,
|
|
2299
2299
|
maxBufferHole: 0.5,
|
|
2300
|
-
|
|
2300
|
+
// Be patient with large 4K/HDR fragments before declaring a stall
|
|
2301
|
+
highBufferWatchdogPeriod: 5,
|
|
2302
|
+
nudgeOffset: 0.2,
|
|
2303
|
+
nudgeMaxRetry: 3,
|
|
2301
2304
|
startLevel: -1,
|
|
2302
2305
|
abrBandWidthFactor: 0.95,
|
|
2303
|
-
abrBandWidthUpFactor: 0.7
|
|
2306
|
+
abrBandWidthUpFactor: 0.7,
|
|
2307
|
+
abrEwmaDefaultEstimate: 5e6
|
|
2304
2308
|
});
|
|
2305
2309
|
hlsRef.current = hls;
|
|
2306
2310
|
let pinnedLevel = -1;
|
|
@@ -2376,6 +2380,7 @@ function Video({
|
|
|
2376
2380
|
});
|
|
2377
2381
|
let mediaErrorAttempts = 0;
|
|
2378
2382
|
let audioAppendErrors = 0;
|
|
2383
|
+
let stalledOnPinnedLevel = 0;
|
|
2379
2384
|
hls.on(Hls.Events.ERROR, (_, data) => {
|
|
2380
2385
|
const fragUrl = (data.frag?.url ?? data.url ?? "").slice(-80);
|
|
2381
2386
|
const fragType = data.frag?.type ?? "?";
|
|
@@ -2396,6 +2401,19 @@ function Video({
|
|
|
2396
2401
|
} else {
|
|
2397
2402
|
audioAppendErrors = 0;
|
|
2398
2403
|
}
|
|
2404
|
+
if (data.details === Hls.ErrorDetails.BUFFER_STALLED_ERROR && pinnedLevel >= 0) {
|
|
2405
|
+
stalledOnPinnedLevel += 1;
|
|
2406
|
+
if (stalledOnPinnedLevel >= 4) {
|
|
2407
|
+
stalledOnPinnedLevel = 0;
|
|
2408
|
+
const nextLevel = Math.max(0, pinnedLevel - 1);
|
|
2409
|
+
console.warn("[Silo/hls] repeated stalls on pinned level", pinnedLevel, "\u2014 stepping down to", nextLevel);
|
|
2410
|
+
pinnedLevel = nextLevel;
|
|
2411
|
+
hls.currentLevel = nextLevel;
|
|
2412
|
+
setSelectedQuality(nextLevel === 0 ? "auto" : `hls-${nextLevel}`);
|
|
2413
|
+
}
|
|
2414
|
+
} else if (data.details !== Hls.ErrorDetails.BUFFER_STALLED_ERROR) {
|
|
2415
|
+
stalledOnPinnedLevel = 0;
|
|
2416
|
+
}
|
|
2399
2417
|
return;
|
|
2400
2418
|
}
|
|
2401
2419
|
if (data.details === Hls.ErrorDetails.FRAG_PARSING_ERROR && fragType === "audio") {
|
|
@@ -2568,7 +2586,6 @@ function Video({
|
|
|
2568
2586
|
}
|
|
2569
2587
|
if (option.type === "hls" && hlsRef.current && option.index != null) {
|
|
2570
2588
|
hlsRef.current.__pinLevel?.(option.index);
|
|
2571
|
-
hlsRef.current.nextLevel = option.index;
|
|
2572
2589
|
hlsRef.current.currentLevel = option.index;
|
|
2573
2590
|
return;
|
|
2574
2591
|
}
|