Fri Sep 14 2018
Measuring Concurrent Viewers
Concurrent viewers are defined as the number of people that at the same time have been watching a video. With Bitmovin Analytics it is quite simple to get to this number, but there are some caveats that apply.
To get the number of users that have been playing a video over time you'd run a query like this:
1queryBuilder2 .count('IMPRESSION_ID')3 .licenseKey('<YOUR LICENSE KEY>')4 .between(fromDate, toDate)5 .filter('PLAYED', 'GT', 0)6 .interval('HOUR')7 .query();
By default the dashboard displays most things in hourly intervals, so the above query will return a table of hours with the number of impressions that watched in that hour. This is obviously not the number of concurrent viewers because if every minute 10 people join the stream and 10 other people leave the stream you'd still end up with 60*10 = 6000 impressions but only 10 concurrent viewers at any time.
By definition the Bitmovin Analytics clients send at least one sample per minute to the server, so to get to the number of concurrent viewers you have to select a
MINUTE interval. This works great for shorter time-spans like 1-3 hours, but doesn't work for longer periods like a 24h period (as to get the accurate count you'd require 24*60 rows).
If all you are interested in is the total maximum of concurrent viewers this query will give you the minute with the most concurrent viewers:
1queryBuilder2 .count('IMPRESSION_ID')3 .licenseKey('<YOUR LICENSE KEY>')4 .between(fromDate, toDate)5 .filter('PLAYED', 'GT', 0)6 .groupBy('MINUTE')7 .orderBy('FUNCTION', 'DESC')8 .limit(1)9 .query();
orderBy('FUNCTION', 'DESC') will order the result by the aggregation function - thus in this case by the maximum number of concurrent viewers in one minute groupings.