views:

139

answers:

2

I'm playing around with streaming live video to the Flash Player. The problem is, it seems (from my logs) that many users will open a live video feed and then just leave it open all day, whether or not they are actually watching it.

As you can imagine, this is a horrendous waste of bandwidth. So I would like a way to determine if the user is actively watching the feed, and if not, close it. The window containing the Flash component should at least have to be the active window.

Can this be done? What solutions can you think of?

Thanks!

+6  A: 

Your problem isn't really flash-related: you should use javascript to fire an instruction to your flash app to kill the stream when the embedding window has lost focus.

You can display a message in the player's viewport to the effect that the stream has been paused: if the user wants to resume playback they can simply hit play again.

Coded Signal
You might also want to check out the deactivate event (not sure if this is exactly what you want): http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/events/EventDispatcher.html#event:deactivate
Cameron
A: 

I'd also start the player paused and only start once the window recieves focus - this means anyone randomly opening lots of tabs doesn't start the movie playing until they get to the tab with the video - It's nice for the user and also saves your bandwidth.

widgisoft
I have to admit I'm terrible for just clicking all the links in a page as I go - "just in case" I might need to read it later - then I don't have to wait for it to load, 9 times out of 10 I just close the window with all the tabs and waste all that lovely bandwidth :-p
widgisoft