Video Ads

The following code block sets up a video ad and loads it:

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    // set whole video surface clickable
    [SAVideoAd disableSmallClick];

    // set config to production
    [SAVideoAd setConfigurationProduction];

    // to display test ads
    [SAVideo enableTestMode];

    // lock orientation to portrait or landscape
    [SAVideo setOrientationPortrait];

    // enable or disable a close button
    [SAVideoAd enableCloseButton];

    // enable or disable auto-closing at the end
    [SAVideoAd disableCloseAtEnd];

    // start loading ad data for a placement
    [SAVideo load: 30479];
}

Once you’ve loaded an ad, you can also display it:

@IBAction void onClick:(id) sender {

    // check if ad is loaded
    if ([SAVideoAd hasAdAvailable: 30479]) {

        // display the ad
        [SAVideoAd play: 30479 fromVC: self];
    }
}

These are the default values:

Parameter Value
Configuration Production
Test mode Disabled
Orientation Any
Closes at end True
Close button Disabled
Small click button Disabled