@kolkrabbi/kol-component 0.253.0 → 0.254.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kolkrabbi/kol-component",
3
- "version": "0.253.0",
3
+ "version": "0.254.0",
4
4
  "description": "The core component library",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -26,8 +26,8 @@
26
26
  "embla-carousel-react": "^8.6.0",
27
27
  "pdfjs-dist": "^6.3.289",
28
28
  "react-syntax-highlighter": "^16.1.1",
29
- "@kolkrabbi/kol-search": "^0.3.0",
30
- "@kolkrabbi/kol-markdown": "^0.1.3"
29
+ "@kolkrabbi/kol-markdown": "^0.1.3",
30
+ "@kolkrabbi/kol-search": "^0.3.0"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "@kolkrabbi/kol-icons": ">=0.22.0",
@@ -22,8 +22,25 @@ import Hls from 'hls.js'
22
22
  * @param {boolean} active plays only while true (default true) — an
23
23
  * off-stage carousel slide pauses instead of autoplaying beside the
24
24
  * active one (FeaturedCarouselFullWidth, 2026-08-26)
25
+ * @param {Object} hlsConfig hls.js config spread over `HLS_DEFAULTS`; read when `src` attaches
26
+ * (a changed object alone does not reload the stream)
25
27
  */
26
- export default function BackgroundVideo({ src, poster, className, onEnded, active = true, ...props }) {
28
+ /* START WHERE THE PLAYER CAN SHOW IT (BackgroundVideoStartsAtLowestRendition, kol-website
29
+ * 2026-10-13 — user: *"why is this video so low res? … its super long lag till you get good res?"*).
30
+ * A bare `new Hls()` starts at the manifest's FIRST rendition (360p on every bucket master) on a
31
+ * 500 kbps guess and only climbs after measured fragments, so a 640px card played upscaled 360p
32
+ * until ABR caught up. Auto start level, a broadband guess until measured, and never above the
33
+ * element's own size. The ticket's three keys plus `testBandwidth: false`. */
34
+ export const HLS_DEFAULTS = {
35
+ startLevel: -1,
36
+ /* without this, an auto start still loads its FIRST fragment at the lowest rendition to measure
37
+ * bandwidth — measured 2026-10-13: 360 → 720 with it on, 720 from the first fragment with it off */
38
+ testBandwidth: false,
39
+ abrEwmaDefaultEstimate: 8_000_000,
40
+ capLevelToPlayerSize: true,
41
+ }
42
+
43
+ export default function BackgroundVideo({ src, poster, className, onEnded, active = true, hlsConfig, ...props }) {
27
44
  const videoRef = useRef(null)
28
45
 
29
46
  useEffect(() => {
@@ -38,7 +55,7 @@ export default function BackgroundVideo({ src, poster, className, onEnded, activ
38
55
  if (!video || !src) return
39
56
 
40
57
  if (Hls.isSupported()) {
41
- const hls = new Hls()
58
+ const hls = new Hls({ ...HLS_DEFAULTS, ...hlsConfig })
42
59
  hls.loadSource(src)
43
60
  hls.attachMedia(video)
44
61
  return () => hls.destroy()
@@ -46,7 +63,7 @@ export default function BackgroundVideo({ src, poster, className, onEnded, activ
46
63
  // Safari native HLS support
47
64
  video.src = src
48
65
  }
49
- }, [src])
66
+ }, [src]) // eslint-disable-line react-hooks/exhaustive-deps -- hlsConfig is read at attach
50
67
 
51
68
  return (
52
69
  <video