hls.js ESM builds skip the transmuxer worker by default, here is how to fix it
The ESM build of hls.js, introduced in version 1.4, does not bundle the transmuxer worker inline, meaning video transmuxing runs on the main thread unless a workerPath is explicitly configured. The default enableWorker: true setting is misleading, as it only signals intent to use a worker if available rather than confirming one is actually running. Developers can verify whether a worker is active by checking the browser's resource performance entries or the DevTools thread panel during playback. The fix involves passing a resolved URL for hls.worker.js via the workerPath option, with syntax varying slightly across bundlers such as Vite, webpack 5, and Next.js. Additionally, a PerformanceObserver tracking long tasks exceeding 50ms can help distinguish main-thread stalls from network-related buffering issues.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in