Get percentage of SWF file played at the PHP side

Hello,

I have a site in PHP. My director has told me to create a splash screen which would show some short Flash movie (very important for the company current advertising plan). This screen would be shown as the first screen of the CMS with the button “proceed to the site” for the users who would not like to watch the advertising.

I know such screens could be possibly irritating for users but I have my orders and need to implement it.

The problem is the director would like to know which percent or how many seconds the movie is topically played. So I need to think of a way of collecting such statistical data at the server side. And provide some statistics.

I tried to search Google on this but have been unable to find any good hints on Flash player statistics.

I see 2 ways to try to solve the statistics problem:

  1. To send the swf file to a user by a PHP script and to see how much content has been sent at all. This would be completely a PHP solution. But I do not see how I could monitor how much content has been sent… Normal readfile() would send all the content to the user. I would be very grateful if someone could possibly give me any hints how Icould monitor the amount of file sent at the server side to the client… Is there any way to send swf file with chunks or something like this?

  2. it could be possible to find or buy an swf-player which could provide some feedback. E.g. when user clicks the button “omit the movie”, I could collect such data from the player with JavaScript and send it to the server using e.g. AJAX or simply send it by GET or POST to some page, store the result in the DB there and then redirect from that page to the main page of the site by GET. If anyone could tell me of any Flash player witch could provide such feedback to me (percentage of movie being played which could be read by JavaScript), I would be very grateful.

I would prefer to solve the problem at the PHP side only. I understand that amount of content sent is not exactly the same as amount of content watched… But if a quick solution for this could be found, it would be great…

Thank you very much in advance!

I think a combination of no 2 and flash is required. If you have a skip link in your flash player then the flash itself could simply redirect the page to the next page with the current amount of the video played in the url.

That way you can get the data using $_GET[‘played_amount’] type of code. It would also be more precise since you can be fairly accurate with the position of the video being played.

Thanks for the answer.

Yes, it certainly should be more accurate especially because the movie would be small and would be buffered by the player…

The problem for me now would be to find a good player which had some API to use with JavaScript… Native Adobe Flash player does not seem to provide any methods of this kind which could be used with JavaScript. Or I have been unable to find any information about such methods…

  1. Isn’t an option because the date will load faster on the client than is getting consumed during playback.

  2. You can set up the flash player to periodically communicate directly with a php script or via externalInterface to javascript in the page. You’re unlikely to find a player that has this built in, best bet would be to look at longtailvideo and see if their api provides anything like this.

  3. Hook up your flash player to google analytics http://www.google.com/support/analytics/bin/answer.py?hl=en&answer=55520

http://www.google.co.uk/search?q=flash+to+javascript+communication

Yes, thanks. Still I have been trying to avoid the original movie files each time a new movie is used.

I have found some players which have time tracking API for JavaScript implemented (sorry, all links are left in the office so I am not posting them currently). Still the players are not free and I was looking for a free solution first. Only if not found, I would propose to buy such a player to the director…

As to Google Analytics, thanks, great idea! We are using it at the site. I did not know it could be used with Flash too. We would certainly hook Flash player to Google Analytics. Thanks for it!