Ad SWC is now compatible with Player API SWC

We recently announced that the BrightcovePlayerAPI.swc will be compatible with bc_ads.swc. Well, that time is now here! In order to start working with both SWCs in your ad features, you only have to add a few things to your current implementation:

Wrap your adContext.moduleLoader in com.brightcove.fl.advertising.api.BrightcoveModuleWrapper right when you gain access to the ad context. Then, use the BrightcoveModuleWrapper instance to add and remove event listeners, load modules and get access to particular API modules. For example, if you are making edits to your Ad Display SWF, your implementation might be similar to the following:

override public function displayAd(adContext:AdSwfContext):void {
   adContext = adContext; 
  // Wrap adContext.moduleLoader in the BrightcoveModuleWrapper for use with both 
  // development API swcs. 
  moduleLoader = new BrightcoveModuleWrapper(adContext.moduleLoader as IEventDispatcher); 
  // before we do anything else, we load the API modules for potential use 
  moduleLoader.addEventListener(Event.COMPLETE, modulesLoaded); 

Once the modules are loaded, they can be typed accordingly so that development goes faster and easier:

private function modulesLoaded(event:Event):void {
   moduleLoader.removeEventListener(Event.COMPLETE, modulesLoaded); 
   videoPlayer = moduleLoader.getModule(APIModules.VIDEO_PLAYER) as VideoPlayerModule; 
   advertising = moduleLoader.getModule(APIModules.ADVERTISING) as AdvertisingModule; 
   experience = moduleLoader.getModule(APIModules.EXPERIENCE) as ExperienceModule; 

Enjoy developing and enhancing your ad features!