VPAID addEventListener not registering

226 views
Skip to first unread message

Corey H

unread,
Mar 7, 2016, 5:11:43 PM3/7/16
to Interactive Media Ads SDK
I'm working on a VPAID unit. when I do this.addEventListener(VPAIDEvent.AdStarted, callback) inside of the initAd method or loadAd method, this callback never gets called. When I run this on other test players, it works. Is there something that Google does for event handling that would prevent this callback from firing? Thank you in advance!

Tyler Sidell (IMA SDK Team)

unread,
Mar 7, 2016, 5:25:32 PM3/7/16
to Interactive Media Ads SDK
Hi Corey,

Just have a few questions for you:
  • Which SDK are you using; HTML5 or Flash?  
  • Do you have a live implementation that you can provide?  
  • What other test players are you using and which player are you currently using?  
  • What is your particular use case for VPAIDEvent.AdStarted?  
There shouldn't be anything on our end to prevent this callback from firing but please provide the details above so we can troubleshoot.  However, please not that this is a VPAID event, not a SDK event.

Thanks,
Tyler Sidell
IMA SDK Team
Message has been deleted

Corey H

unread,
Mar 7, 2016, 5:41:53 PM3/7/16
to Interactive Media Ads SDK
Hi Tyler,

I'm using the Flash implementation. 
Here's a live implementation: https://goo.gl/QhRtDT

There's supposed to be a log of "Event callback worked. Event is:     [Event type="AdStarted" bubbles=false cancelable=false eventPhase=2]" 

If I use JW Player Ad tester http://demo.jwplayer.com/ad-tester/ and plug in the below ad tag, I see the log message. For Google Video Suite Inspector, it doesn't register the event.


My use case for VPAIDEvent.AdStarted, is to register event listeners based on when VPAID events are dispatched. It could have been any other VPAID event. I just used AdStarted for this example.

Here's a simple example of what the code looks like: 

public function initAd(width:Number, height:Number, viewMode:String, desiredBitrate:Number, creativeData:String, environmentVars:String) : void {
            log('BasicVPAID : initAd called. dimensions: ' + width + 'x' + height + ', viewMode: ' + viewMode);
           
            this.addEventListener(VPAIDEvent.AdStarted, hi); //VPAIDEvent.AdStarted is equal to a string of 'AdStarted'

            this.loadAd();
            
            return;
}// end function

private function hi(e:Event):void { //this hi callback is registered above
            log('Event callback worked. Event is:     ' + e);
}

Thank you for your help

Tyler Sidell (IMA SDK Team)

unread,
Mar 8, 2016, 9:48:41 AM3/8/16
to Interactive Media Ads SDK
Hi Corey,

Thanks for providing these details.  Have you tried setting up your own implementation of the SDK?  Based on the VPAID specs (Section 7.2), event class definitions are not shared between the player and the ad.  You would also have to declare the following class definitions in the player itself:
package
{
 
import flash.events.Event;
 
public class VPAIDEvent extends Event
 
{
 
public static const AdLoaded : String = "AdLoaded";
 
public static const AdStarted : String = "AdStarted";
 
public static const AdStopped : String = "AdStopped";
 
public static const AdLinearChange : String = "AdLinearChange";
 
public static const AdExpandedChange : String = "AdExpandedChange";
 
public static const AdRemainingTimeChange : String= "AdRemainingTimeChange";
 
public static const AdVolumeChange : String = "AdVolumeChange";
 
public static const AdImpression : String = "AdImpression";
 
public static const AdVideoStart : String = "AdVideoStart";
 
public static const AdVideoFirstQuartile : String= "AdVideoFirstQuartile";
 
public static const AdVideoMidpoint : String = "AdVideoMidpoint";
 
public static const AdVideoThirdQuartile : String= "AdVideoThirdQuartile";
 
public static const AdVideoComplete : String = "AdVideoComplete";
 
public static const AdClickThru : String = "AdClickThru";
 
public static const AdUserAcceptInvitation : String= "AdUserAcceptInvitation";
 
public static const AdUserMinimize : String = "AdUserMinimize";
 
public static const AdUserClose : String = "AdUserClose";
 
public static const AdPaused : String = "AdPaused";
 
public static const AdPlaying : String = "AdPlaying";
 
public static const AdLog : String = "AdLog";
 
public static const AdError : String = "AdError";
 
private var _data:Object;
public function VPAIDEvent(type:String, data:Object=null, bubbles:Boolean=false,
cancelable
:Boolean=false) {
IAB
Video Player-Ad Interface Definition (VPAID)
 
super(type, bubbles, cancelable);
 _data
= data;
 
}
 
public function get data():Object {
 
return _data;
 
}
 
}
}
// sample ad dispatch call from a function within ad’s VPAID class
dispatchEvent
(new VPAIDEvent(VPAIDEvent.AdStarted));
dispatchEvent
(new VPAIDEvent(VPAIDEvent.AdClickThru,
 
{url:myurl,id:myid,playerHandles:true}));
The player uses addEventListener with a handler function that that receives a * typed
parameter that will be the custom
event. To continue the above example:
public function onAdClickThru(event:*) : void
{
 trace
(“Ad url is: + event.data.url);
}
_VPAID
.addEventListener(VPAIDEvent.AdClickThru, onAdClickThru);  


Also, from the SDK you can use AdEvent.Log to test as it dispatches when a VPAID ad fires a LOG event.

Thanks,
Tyler Sidell
IMA SDK Team
Reply all
Reply to author
Forward
0 new messages