Jul 11, 2013 at 9:59 PM
Edited Jul 11, 2013 at 10:40 PM
I'm not sure why last time the player.InteractiveViewModel.CurrentStateChanged event fired before it was supposed to do so, but now this seems to work.
But the other problem still exists (changing the behavior when the user clicks on a VAST 2 linear video ad).
I first solved it dirty with setting the clickthrough URL to null in the Player Framework Code (AdHost.cs), so the PF wouldn't launch and then I had to get the URL to launch it myself via a very long detour:
var ClickThroughUri = ((CreativeLinear)((AdDocumentPayload)adSchedulerPlugin.Advertisements.Source.Payload).AdPods.Ads.Creatives).ClickThrough;
I changed this to do everything in single steps with checking for null etc. But it was still ugly and also I soon realized I had to do something similar with the ClickTracking URLs as well, not just ClickThrough, because the PF fires the tracking URLs before
the user clicks on the "open browser" dialog I mentioned before and also when the user returns from an ad, which is paused at that time, and he clicks on the player to make the play button reappear, the tracking URLs get fired as well.
What I thought I could do then instead of the ugly things above was registering for the event myself (ActiveAdPlayer_AdClickThru), which you can access via the player. I found out the clickthrough URL even is available in the event args, so that was really
useful. Then I commented out the registering of the event handler in AdHost.cs:
activeAdPlayer.AdClickThru += Vpaid_AdClickThru;
This didn't help though. Turns out the HyperlinkButton that's overlayed on the player has its own life and the only way to stop it from launching the URI really seems to be to set the NavigateUri to null in the ClickThroughButton_Click event. Not at another
place, because this way I still get the URL delivered to my own event handler (the above mentioned ActiveAdPlayer_AdClickThru).
And now I'm stuck with the clicktracking URLs. The last event handler that gets called where they get handled (or at least read) is player_AdClickThru in VpaidController.cs.
The URLs aren't in the event args of the mentioned ActiveAdPlayer_AdClickThru and there doesn't seem to be an easy way to access the VpaidController via the player which is pretty much the only thing I have access to from outside the PF. And if I had access
to the VpaidController the activeAds would still be private. I could just make it public in the source code, but I don't want to mess around in it in so many different places (makes it hard to update to new PF versions).
So again it boils down to this: How can you alter the behavior when the user interacts with an ad in general (best practice / without changing lots of code in lots of different places) and how can you fix my problem in particular (getting the clicktracking
urls and maybe also changing the HyperLinkButton behavior)?
Thanks in advance!
P.S.: Also I can't find any UML diagrams or anything similar that would make it easier to find ones way through the source code.