views:

42

answers:

2

I want to add tracking to our Flash-based media player so that we can provide analytics that show what sections of videos are being watched (at the moment, we just register a view when a video starts playing)

For example, if a viewer watches the first 30 seconds of a video and then clicks away to something else, we want the data to reflect that.

Likewise, if someone watches the first 10 seconds, then scrubs the timeline to the last minute of the video and watches that, we want to register viewing on the parts watched and not the middle section.

My first thought was to collect up the viewing data in the player and send it all to the server at the end of a viewing session. Unfortunately, Flash does not seem to have an event that you can hook into when a viewer clicks away from the page the movie is on (probably a good thing - it would be open to abuse)

So, it looks like we're going to have to make regular requests to the server as the video is playing. This is obviously going to lead to a high volume of requests when there are large numbers of simultaneous viewers.

The simple approach of dumping all these 'heartbeat' events from clients to a database feels like it will quickly become unmanageable so I'm wondering whether I should be taking an approach where viewing sessions are cached in memory and flushed to database when they become inactive (based on a timeout). That way, the data could be stored as time spans rather than individual heartbeats.

So, to the question - what is the best way to approach dealing with this kind of high-volume viewing data? Are there any good existing architectures/patterns?

Thanks,

Dan.

A: 

You can use the javascript 'onbeforeunload' hook to trap page exits. You can also combine this with some flash/js interaction to aggregate all the data and send it in one batch.

disown
A: 

Are you using Flash Media Server for streaming ? If yes the server can do all this things for you.

Cornel Creanga
I can't find an obvious part of the FMS documentation that covers this - could you provide any further info (e.g. feature name) that would help find it?
DanK
Take a look here: http://help.adobe.com/en_US/FlashMediaServer/3.5_AdminGuide/WS5b3ccc516d4fbf351e63e3d119f2926bcf-79d1.html#WS5b3ccc516d4fbf351e63e3d119f29260bd-7ff2
Cornel Creanga
Thanks - some interesting stuff in there. Looks like the right logging settings and a process to analyse the logs might form a solution.
DanK