Quick Summary
Is there a way in actionscript to detect when the user clicks on “empty space” in a chromeless video player instance (i.e. a click that doesn’t cause the player to react)? This is particularly important when the chromeless player is displaying an overlay ad.
If not, is there a way to detected when a user clicks-on or closes an overlay ad?
Details
My flash-based application needs to interpret “empty” mouse clicks on the video window as a trigger for a specific action. This behavior is is demonstrated in youtube’s “full” flash player – clicking on an “empty area” that doesn’t otherwise invoke an action toggles between pause-and-play, and double-clicking an empty area toggles between windowed-and-fullscreen.
This is simple enough while playing self-hosted content – I can just assume any click on the video window is an empty click, and can act appropriately.
This, however, is not the case when I’m playing a youtube video, as it can popup an overlay ad over the video content. I need to allow the user to interact with the ad, but still let my application’s logic handle clicks on the “empty” areas of the chromeless player.
I’ve spent ages trying to solve this, and haven’t made any headway. The documentation doesn’t cover this. There isn’t any new state thrown via onStateChange in response to displaying or interacting with an ad. There doesn’t appear to be an API change associated with displaying an overlay ad (no onApiChange is thrown, and polling getOptions() didn’t turn up anything). Kludging a work-around using getObjectsUnderPoint didn’t work. I even tried backwards-engineering the information by polling the Mouse.cursor state (it visually gets set to “hand” when hovering over interactive objects in the chromeless player… but it’s set to “auto”).
Any suggestion on how to accomplish this? Particularly in a manner that’s transparent to whether the chromeless player is using StageVideo or not?
While this is an area where the Players API team recognizes the need to improve things (by creating a callback that’s fired when an ad or other overlay is shown, or trying to return information about what rectangle of a video player is “safe” from overlays), there’s nothing at the moment in the API that accomplishes what you’re after.
Feel free to file a feature request for tracking purposes, and we can keep that up to date if anything develops.