Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling multiple instances of hls.js #6889

Open
survto opened this issue Dec 4, 2024 · 1 comment
Open

Handling multiple instances of hls.js #6889

survto opened this issue Dec 4, 2024 · 1 comment

Comments

@survto
Copy link

survto commented Dec 4, 2024

Hi,
I am working on a web console that involves instantiating 3 HLS.js players .
HLS players randomly generate both MediaError (bufferStalledError) and NetworkError (manifestParsingError, audioTracklLoadError, levelLoadError). These errors cause continuous restarts of the players.
I noticed that as the number of players increases, the errors increase and the latency increases.
Are there any known issues about player behavior when we have multiple instances?
How resilient is the hls.js player?
Are there any workarounds or best practices to minimize the number of errors?
Thanks in advance

@robwalch
Copy link
Collaborator

robwalch commented Dec 4, 2024

You can instantiate as many instances of hls.js as you want, but you are responsible for performance. Parsing errors are a result of content issues, but stalling and network errors indicate an issue with resources on the client or server. To play media with an HLS.js instance you need an HTMLMediaElement. Not all platforms support playback with multiple (or many) elements. The number of hls.js instances should be limited based on platform resources. Three hls.js instances is a very reasonable number. You might want to consider enabling level capping (see capLevelToPlayerSize and capLevelOnFPSDrop in the API docs) so that each players selection is limited to its display area and lowers quality when frame drops are detected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants