TIL counting viewers of an HLS live stream is a hard fucking problem and there's no right answer. It's all based on heuristics and approximations.
This stems from the fact that viewers are just constantly making intermittent http calls for the .ts fragments of the stream. That's basically a huge mess to figure out who is connected since it's not long lasting.
There seems to be 3 main ways to count:
* Using an analytics proxy server 🤮🤮🤮
* Using the current number of established tcp inbound connections to port 443 from unique IPs
* Parsing the webserver (nginx) logs to make sense of it.
My question is, with so many good technical alternatives, why did the world settled on HLS as the standard for livestreams? It sucks.
See it as a feature, not as a bug.