Categories
IT Servers Streaming

Statistics and Webpage for HLS server

Simple statistics about your stream while re-streaming.

I need a few statistics for the HLS server because as you stream the .m3u8 file, it’s a bit hard to tell how many people are using the app to watch it. I’ve inserted a couple statistics pages on this server to help get a better pictures of who’s using it.

The first way is to use the RTMP streaming statistics as seen in the /etc/nginx/sites-available/default file at the location at the bottom.

## XML stylesheet to view RTMP stats. Copy stat.xsl wherever you want and put the full directory path here
location /stat.xsl {
	root /var/www/html/;
	}
## This provides RTMP statistics in XML at 
location /stat {
	rtmp_stat all;
	rtmp_stat_stylesheet stat.xsl;
	}

This outputs a nice little page that looks like below:

The next bit of Stats that I added was the below. This is from the stub_status output. It’s very simple and only somewhat useful, but it’s a start on seeing how many people are on my .m3u8 feed. The active connections is the useful part however because of the internal connections and my own viewing of this page, out of the 11 seen connections I think only about 3 or so are actually users on our app in the below case.

I put in a little index.html file to replace the original that tells you Nginx on a standard install of Nginx. I made my page just give a few links to the various status reports on the server. It makes it a little bit easier to use and will help when I train others to use these servers later. The status page looks like the below:

This is made with an index.html file with the links to the low resolution, high resolution HLS feeds as well as the two status pages.

  • Connection link: https://your_domain_name_here.xyz/nginx_status
  • RTMP feed status: https://your_domain_name_here.xyz/stat.html
  • Low Res link: https://your_domain_name_here.xyz/low.html
  • High Res link: https://your_domain_name_here.xyz/live.html

I’m still trying to find more ways to get better statistics out of the HLS feed use, however I haven’t gotten there yet. I’ll probably keep this updated to tell others when I find more ways to do it.

Leave a Reply

Your email address will not be published. Required fields are marked *