Reply
Visitor
vp_integrations
Posts: 7
Registered: ‎11-01-2011
0 Kudos

setAdRules not waiting for AdRulesReady

I have a custom Brightcove plugin that listens for onMediaChange events from a playlist of videos and updates the adPolicy and adRules parameters accordingly for each video. All videos in the playlist get assigned the same AdRules swf with different policies, except the second video which uses an AdTranslator from another ad server. When switching between, say, the first and third videos, one expects adModule to be updated when one calls setAdPolicy, setAdRules.

_adModule.setAdPolicy(adPolicy);
_adModule.setAdRules(adSource);

 

The problem arises when _adModule.setAdRules() is called, which triggers the prerollCheck() function in the AdRules swf immediately without waiting for it to signal AdRulesReady(). This results in an attempt to play a preroll using an ad player that does not yet exist. 
Does this sound to you like an issue with the implementation of the AdRules swf, the adModule switching plugin, or the Brightcove API function setAdRules?
Any thoughts would be much appreciated!
Brightcove Team
BC-Oscar
Posts: 503
Registered: ‎12-11-2008
0 Kudos

Re: setAdRules not waiting for AdRulesReady

 

  This sounds like a bug. We'll start investigating this but can you provide a simplied ad rules class that shows the issue?

 

 

Brightcove Team
BC-BrianD
Posts: 275
Registered: ‎12-10-2008
0 Kudos

Re: setAdRules not waiting for AdRulesReady

Someone should have contacted you about this issue (Crystal) or should shortly.  If you don't hear from us, let me know.

-----
Brian Deitte, Brightcove player developer
http://twitter.com/bdeitte
Visitor
vp_integrations
Posts: 7
Registered: ‎11-01-2011
0 Kudos

Re: setAdRules not waiting for AdRulesReady

Thanks for your help, Brian and Crystal.

 

The bug fix solved the initial issue of setAdRules() not waiting for adRulesReady(), but I've found a related issue now that I need your help with. The scenario again is a playlist of videos, a custom AdRules swf, and an additional video player plugin (AdSource.swf) that dynamically changes the AdPolicy for each video in the playlist.

 

Everything works as expected when not using the AdSource plugin, on MediaEvent.CHANGE event we reset our ad player and call prerollCheck() to initiate a new ad session while maintaining the same instance of the AdRules class. However, when the AdSource plugin is added it creates a new instance of the AdRules class on each MediaEvent.CHANGE event (presumably when it calls setAdRules), which might be OK except that the VideoPlayer maintains references to the previous instance(s), such as event listeners for MediaEvent.PLAY, MediaEvent.STOP, etc. The result is that each AdRules instance picks up on these events and sends multiple events to multiple ad player instances. After a couple of videos, this could get quite heavy and crash the Flash player.

 

So my question: Is it the responsibility of the AdSource plugin to use the same instance of the AdRules class for each new item, or is it the responsibility of the AdRules class to properly unload itself (ie. remove all event listeners) when a new instance is created? And in the case of the latter, does the Brightcove API offer any unloading hooks?

 

Thanks,

Owen.