Play counts
Jamroom Developers
There's a few things going on here that are going to make play counting like this more difficult.
In a web application like JR, when a media file is streamed, what that means is that JR sends the media file to the web server's buffer as fast as it can (usually in under a second). It is then up to the web server to send the media file to the player at the speed the player can accept it. While this is happening the process is busy, and cannot service other requests. So from JR's point of view, the media file has been "played" as soon as it is done dumping it to the buffer. To change it so the media play is only counted after X seconds, means the file has to be read and sent at the data rate that equates to X bytes per second (varies depending on the media) + some small amount to prevent buffering, as well as an initial "boost" amount. After X seconds is up, the process can then "dump" the rest of the media file and move on to the next. What this means is the PHP process is tied up for X seconds (the duration of the "count"), so your infrastructure has to be ready to handle that - i.e. larger or more boxes with more front end processes to handle X simultaneous users streaming at once - each listener will tie up a process for at least 30 seconds (or whatever you set the play length to).
Also - this method would not work with your media being on Amazon S3, since the media is streamed from S3 and not through a JR view function, so it cannot be properly tracked. Your media would have to stream from the box it is served from (or from attached storage). I know you use S3 so this is important to know.
This type of tracking is actually what JR4 did, and it caused issues on larger sites, so with JR5 we went for a much simpler approach. User plays are tracked by user and IP, and only 1 stream per day per user/ip is counted.
Let me know if that helps.