New to HLS.js and trying to make my streams as performant as possible! #7443
Replies: 4 comments 3 replies
-
I wouldn't bother adding
If you do that, you need to limit how many active player or hls.js instances are allowed at once. Deferring calls to |
Beta Was this translation helpful? Give feedback.
-
Hey Rob, thanks for the reply.
I may be misremembering - I'm away from my set up right now - but I think I added this to optimistically "force" the stream to a certain quality, avoiding the pixelated start (because it's a hero video). I thought testing the bandwidth and startlevel -1 might let it change quickly if that optimistic guess was incorrect. Like I said, I'm new, so there's a good chance this is completely wrong and not how I should be doing things!
Interesting, thanks. I've an Basically I've videos further down the page, but more importantly I've 4 in a hero bento grid, and only want the first to play, with the others only playing when expanded. This sounds like the right option, but if you've got any more advice I'd greatly appreciate it! Thanks again, Nick
|
Beta Was this translation helpful? Give feedback.
-
You can also suspend segment loading (audio, video, and subtitle data) using |
Beta Was this translation helpful? Give feedback.
-
For your HLS.js settings with a 60-second, 238MB video on bunny.net, the current approach is mostly sound but can be optimized. The testBandwidth enabled is useful for adaptive streaming across different networks. Your abrEwmaDefaultEstimate of 5 Mbps may be too high; lowering this closer to typical user bandwidth improves initial quality selection and reduces buffering risk. Buffer settings like maxBufferLength (30s) and maxMaxBufferLength (60s) are higher than needed for a short video and can increase memory consumption and startup delay. Reducing maxBufferLength to around 15-30 seconds is usually sufficient for smooth playback without excess buffering. For videos further down the page, deferring loading improves performance. Use autoStartLoad: false in HLS.js to prevent preloading, then trigger streaming via hls.startLoad() when the video enters the viewport. In React, lazy loading video components or conditional mounting ensures resources load only as needed, improving page responsiveness. Managing buffer sizes and load triggers this way balances startup speed, network adaptation, and memory use, which aligns with best practices for streaming setups like those used in Cincopa’s video delivery environment. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all,
Sorry for the noob questions, but I'm just trying to get into HLS.js and just want to make sure I'm setting my streams up to be relatively performant.
Currently I've 1 hero video that's hosted on bunny.net, and in its original format is 238mb and 60 seconds long. I'm loading it like this:
Here are my (probably incorrect) reasons for the above:
testBandwidth - to adapt to either mobile or desktop
abrEwmaDefaultEstimate: 5000000 - maybe too high an initial guess for bandwidth?
startLevel: -1 - uses the initial estimate to automatically pick a stream quality
the buffer properties - seem a bit aggressive for this size video? i'm basing that on absolutely nothing XD
Also - for videos further down the page, what's the best way to defer loading/streaming? Should I get every video to load their first chunk and nothing else, and use something like ScrollTrigger (i'm using gsap anyway) to trigger it to start streaming the rest? (if that's even possible). Or should I be conditionally/lazily loading in the components (I'm using react)?
Like I said, sorry for the 20 noob questions, I'm just trying to build up a mental model of how this works :)
Thanks,
Nick
Beta Was this translation helpful? Give feedback.
All reactions