Pre-Roll Advertising




This tutorial is intended to help developers understand how to use the feature of pre-roll advertising using iVdopia SDK.

Integration Checklist


Please refer to the steps mentioned in the tutorial Integrating iPhone SDK to make sure that all the steps are performed before you can use the pre-roll advertising feature.
  • Programming: 
    • Please make sure
[vdoAds openWithAppKey:@MY_APP_KEY  withFrame: frame useLocation: FALSE/TRUE ]; 

or

[vdoAds openWithAppKey: @MY_APP_KEYTRUE withFrame: frame  useLocation: FALSE/TRUE startWithBanners:FALSE/TRUE];
  
                was called correctly with the apikey mentioned in the portal
    • In addition to the openWithAppKey call, please make sure
[vdoAds playVDOAds]; 
or 
[vdoAds playVDOAds:@"Message"];(Added 1.3.9) 

                is called at the appropriate time
  • Portal: Integrate Ads Tab > View App > Format-In App Video is checked
  • Behavior: You have given enough "game time" for the ad to cache

Application Coding

For a proper usability experience to the user and development ease, iVdopia SDK appropriately notifies the developer about the playback status of the advertisement. As mentioned in Integrating iPhone SDK , either 

playedVDOAd;

or

noVDOAd;
will be called.

To make sure that the MediaPlayer behaves properly for the playback of video content, the initialization of Media player should always be done after receiving either of these events.

- (void) playedVDOAd 

{

  

[self playVideoContentAfterPreRoll];

}


or

- (void) noVDOAd 

{

 

[self playVideoContentAfterPreRoll];

}

 

-(void)playVideoContentAfterPreRoll:(NSURL*)url

{

// Play the in-app video here

mMoviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];

if (OS>=3.2)

      

         {


[[NSNotificationCenter defaultCenter] addObserver:self

selector:@selector(movieContentPreload:)

  name:MPMediaPlaybackIsPreparedToPlayDidChangeNotification object:mMoviePlayer];

} else 

        {

[[NSNotificationCenter defaultCenter] addObserver:self 

        selector:@selector(movieContentPreload:) 

        name:MPMoviePlayerContentPreloadDidFinishNotification 

object:mMoviePlayer];

}

}


- (void) movieContentPreload:(NSNotification*)notification

{

[mMoviePlayer play];

if (OS>=3.2)

   {


[window addSubview:mMoviePlayer.view];

}

   // Do the rest of initialization activity here, after this notification is received.

}