In the past we've discussed the various variable Mezzmo tracks to determine whether a file has been played. It has a play counter which is incremented once the play position in the file exceeds the % setting in Mezzmo. There is also a bookmark which tracks the position of when we stop playing a file which can then be shared wit things like the Kodi plug-in and such. We also have the last played variable which tracks when the play counter is incremented.
However, even with these we still have issues where if we preview a file (either manually or by a client which automatically supports a preview mode. FYI, hoping to see this in the Kodi plug-in soon) that messes with some of these variables in a less than desirable way. I'd like to consider something called a total play time variable which is set when Mezzmo starts streaming a file, it counts the amount of time a file is streamed (so it stops counting when a file is paused or stopped) and then when the file is stopped it writes the total time to the Mezzmo Total Played Time variable in the database for that file. When the Total Played Time / the total file time exceeds time % setting in Mezzmo the play counter variable is incremented by 1. This way you could preview a file and not increment any of the play counters. If you played a file for two short increments then Mezzmo would just increment the Total Played Time variable to be the sum of the two and keep track until you hit the instance above where Total Played Time / the total file time exceeds time % setting in Mezzmo.
The only question then is when to zero the Total Played Time variable to zero and start over. I'd suggest that once the play counter variable increments by 1 and the current play position is between the % played point and the end of the file then we stop incrementing the Total Played Time or set the value to equal the file length. Then if the file length is max and the play position goes back to the beginning then we set the Total Play Time to zero to begin the next play count counting. The only potential downside I see here is if multiple clients are laying the same file but that condition exists today too with regards to incrementing the play counter and last time played.
I hope this makes sense.
Bookmarks