MediaElement tracking watch time

Viewed 63

I've been searching for a comprehensive solution for this but i'm just unable to figure out something solid.

I have a table that tracks your current position in the video so you can pick up where you previously were. I also want to track the watch time to determine if a person watched it all the way through ( or at least 90% the way through ). Obviously, this will never be 100% perfect but I want it to actually be worth a damn.

My current idea is to have an array in javascript that is the length of the video duration and on timeupdate event set each second that has been played to 1 to mark it as watched. Then on end event check to see if that is greater than or equal to ~90% of the duration of the video. That should work if the user watches that long in one sitting and also ignore a user seeking forward to "trick" the video into being marked as watched.

Now, what about if they watch 25% of the video and then return the next day to finish the rest? Would it be a bad idea to serialize the aforementioned array to a string and store it in the SQL table? That way I can pull it on next visit and use it to persist the watch time? If not, what would be a better alternative?

0 Answers
Related