▲ | nightpool 5 days ago | |
The other commenters point out more prosaic problems with CDN architecture, but a more product-focused answer for this is "because users execute Javascript but bots don't". Using client side counting is an easy way to filter out simple automated traffic. Also, with segmented MP4 streams, the files on the backend won't necessarily be easy to match up 1:1 with videos. How do you count the views if someone watches a video, and then skips back to watch the middle section a few times, and then doesn't finish it? Because that would show up as (1, 1, 4, 3, 0) in your database for the different files involved. Now imagine doing that for ~500 people on a shared IP address for their high school. And now your minimum threshold for view counting is tied to the size of your MP4 chunks, or range requests. And now you've put this view counting logic into the hot path of serving terabytes of data. From a product perspective, you can see why "A video view is counted the first time the user presses the play button and watches for at least 30 seconds" is a much more desirable definition, both technically and for stakeholders (video creators, advertisers, etc) to understand. |