The CORS trap is the absolute graveyard of web video projects. I've lost count of how many times I've had to explain to someone that their stream isn't "broken," it just doesn't have an Access-Control-Allow-Origin header, and VLC doesn't care about that. The zero-backend approach is great for privacy, but dealing with local .m3u8 files and relative paths is such a headache—good call on forcing the explicit HTTPS base URL there.
Since you built a diagnostics panel, how are you distinguishing between a CORS failure and a generic network timeout? Does hls.js expose enough granularity in its error events to tell the difference, or do you have to do a manual fetch() probe to check the headers first?
Founder of ToolkitLoop (toolkitloop.com) — 30 free online tools that run 100% in your browser. No sign-ups, no uploads, private by design. I write about building indie tools.
Great question — and you nailed the exact trap: "works in VLC, fails in the browser" is almost always CORS, not a broken stream.
Short answer: hls.js gets you partway, but not all the way. A timeout is the one case it names clearly — it reports load timeouts as their own error detail, distinct from a load error. A CORS failure is the opposite: it arrives as a generic network error with no HTTP status and no body, because the browser deliberately hides that information from page JavaScript. So from the hls.js error event alone, you cannot positively prove "this is CORS."
What the diagnostics panel does is surface that distinction honestly: a network failure with no response at all is flagged as a CORS restriction rather than a "broken stream" — but I treat that as a strong hint, not proof. A manual fetch() probe helps rule things out rather than confirm them: if a plain fetch returns a status, it wasn't CORS; if it also fails opaquely, you're still left with CORS vs DNS vs offline ambiguity, and the real confirmation is outside the browser — curl -I on the playlist URL, or the server's response headers showing the Access-Control-Allow-Origin header is missing.
So in practice: timeout = hls.js tells you; CORS = a no-response network error, confirmed out-of-band by the missing header. That's why the panel shows the actual response when it has one, and flags the no-response case instead of pretending the stream is dead.
(Full disclosure: the player is my tool — toolkitloop.com/m3u8-player, free, no signup, and every URL you paste stays in your tab.)
The browser deliberately hiding CORS status codes is one of the most frustrating parts of web debugging. Treating the "no response" case as a strong hint rather than absolute proof is the right call—out-of-band curl checks are indeed the only way to confirm.
Founder of ToolkitLoop (toolkitloop.com) — 30 free online tools that run 100% in your browser. No sign-ups, no uploads, private by design. I write about building indie tools.
Exactly — that's the part that kept tripping me up too. The browser gives you an error with no status and no body, so the panel can only ever say 'this looks like a CORS wall,' never 'this is proven.' The curl check outside the browser is what turns the hint into a confirmation, since curl actually sees the headers. Glad that framing landed — thanks for reading so closely. (Disclosure: I built ToolkitLoop, the free, no-signup, browser-based tools site behind the M3U8 Player — everything runs locally in your browser, nothing is uploaded.)
The "opaque error" is the browser's way of protecting us from the internet, but it makes debugging an absolute nightmare. Curl is basically the ultimate lie detector for web dev.
Also, huge kudos on ToolkitLoop! A zero-backend, local-first architecture is exactly the right way to build browser tools. No signup, no data leaving my machine—that's how it should be done.
Founder of ToolkitLoop (toolkitloop.com) — 30 free online tools that run 100% in your browser. No sign-ups, no uploads, private by design. I write about building indie tools.
Love that phrasing — "curl is the ultimate lie detector" is exactly right. The browser is protecting the user by hiding those details, so the same opacity that keeps a site from probing other origins also leaves the developer with no status, no body, and no way to tell CORS from a dead server from inside the page. Stepping outside the browser is the only way to see the headers for real.
And thank you for the kind words about ToolkitLoop — that local-first shape is the whole point for me: if nothing ever leaves your tab, there's nothing to leak, no account to create, and no server that has to be trusted with your files or URLs. (Disclosure: I built ToolkitLoop — toolkitloop.com/m3u8-player, free, no signup, everything runs in your browser.)
We're a place where coders share, stay up-to-date and grow their careers.
The CORS trap is the absolute graveyard of web video projects. I've lost count of how many times I've had to explain to someone that their stream isn't "broken," it just doesn't have an Access-Control-Allow-Origin header, and VLC doesn't care about that. The zero-backend approach is great for privacy, but dealing with local .m3u8 files and relative paths is such a headache—good call on forcing the explicit HTTPS base URL there.
Since you built a diagnostics panel, how are you distinguishing between a CORS failure and a generic network timeout? Does hls.js expose enough granularity in its error events to tell the difference, or do you have to do a manual fetch() probe to check the headers first?
Great question — and you nailed the exact trap: "works in VLC, fails in the browser" is almost always CORS, not a broken stream.
Short answer: hls.js gets you partway, but not all the way. A timeout is the one case it names clearly — it reports load timeouts as their own error detail, distinct from a load error. A CORS failure is the opposite: it arrives as a generic network error with no HTTP status and no body, because the browser deliberately hides that information from page JavaScript. So from the hls.js error event alone, you cannot positively prove "this is CORS."
What the diagnostics panel does is surface that distinction honestly: a network failure with no response at all is flagged as a CORS restriction rather than a "broken stream" — but I treat that as a strong hint, not proof. A manual fetch() probe helps rule things out rather than confirm them: if a plain fetch returns a status, it wasn't CORS; if it also fails opaquely, you're still left with CORS vs DNS vs offline ambiguity, and the real confirmation is outside the browser — curl -I on the playlist URL, or the server's response headers showing the Access-Control-Allow-Origin header is missing.
So in practice: timeout = hls.js tells you; CORS = a no-response network error, confirmed out-of-band by the missing header. That's why the panel shows the actual response when it has one, and flags the no-response case instead of pretending the stream is dead.
(Full disclosure: the player is my tool — toolkitloop.com/m3u8-player, free, no signup, and every URL you paste stays in your tab.)
The browser deliberately hiding CORS status codes is one of the most frustrating parts of web debugging. Treating the "no response" case as a strong hint rather than absolute proof is the right call—out-of-band curl checks are indeed the only way to confirm.
Exactly — that's the part that kept tripping me up too. The browser gives you an error with no status and no body, so the panel can only ever say 'this looks like a CORS wall,' never 'this is proven.' The curl check outside the browser is what turns the hint into a confirmation, since curl actually sees the headers. Glad that framing landed — thanks for reading so closely. (Disclosure: I built ToolkitLoop, the free, no-signup, browser-based tools site behind the M3U8 Player — everything runs locally in your browser, nothing is uploaded.)
The "opaque error" is the browser's way of protecting us from the internet, but it makes debugging an absolute nightmare. Curl is basically the ultimate lie detector for web dev.
Also, huge kudos on ToolkitLoop! A zero-backend, local-first architecture is exactly the right way to build browser tools. No signup, no data leaving my machine—that's how it should be done.
Love that phrasing — "curl is the ultimate lie detector" is exactly right. The browser is protecting the user by hiding those details, so the same opacity that keeps a site from probing other origins also leaves the developer with no status, no body, and no way to tell CORS from a dead server from inside the page. Stepping outside the browser is the only way to see the headers for real.
And thank you for the kind words about ToolkitLoop — that local-first shape is the whole point for me: if nothing ever leaves your tab, there's nothing to leak, no account to create, and no server that has to be trusted with your files or URLs. (Disclosure: I built ToolkitLoop — toolkitloop.com/m3u8-player, free, no signup, everything runs in your browser.)