Implementation for Interstitial Video ads
Please refer to the link below if you have not downloaded the SDK or created an ad space.
If you have not added the SDK into the Project, please add it by the following methods.
Implementation of interstitial video ad will be done with the following six steps.
- NADInterstitialVideoDelegate
- Create an instance
- Load Video Ad
- Show Video Ad
- Release Video Ad
- Implementation Optional Functions
It conforms to the NADInterstitialVideoDelegate
protocol to receive event notifications.
Swift
import NendAd
class ViewController: UIViewController, NADInterstitialVideoDelegate {
...
}
Objective-C
@import NendAd;
@interface ViewController : UIViewController <NADInterstitialVideoDelegate>
...
@end
First, generate the instance of NendAdInterstitialVideo
.
Set delegate
to receive event notifications.
Swift
// Keep instance
private let interstitialVideo = NADInterstitialVideo(spotID: spotID, apiKey: "apiKey")
...
self.interstitialVideo.delegate = self
Objective-C
@property (nonatomic) NADInterstitialVideo *interstitialVideo;
...
self.interstitialVideo = [[NADInterstitialVideo alloc] initWithSpotID:spotID apiKey:@"apiKey"];
self.interstitialVideo.delegate = self;
The information necessary for instance creation is as follows.
Argument | Type | Description |
---|---|---|
spotID | NSInteger |
SpotID issued by management page of nend |
apiKey | NSString |
ApiKey issued by management page on nend |
Load the ad by loadAd.
Swift
self.interstitialVideo.loadAd()
Objective-C
[self.interstitialVideo loadAd];
The load result is reported by NADInterstitialVideoDelegate
.
Show the ad by showAd after confirmed that loading of ad is completed by isReady
.
The ViewController
set in the parameter must be placed correctly on the UIWindow
hierarchy.
(The self
example below is a subclass of UIViewController
.)
Swift
if self.interstitialVideo.isReady {
self.interstitialVideo.showAd(from: self)
}
Objective-C
if (self.interstitialVideo.isReady) {
[self.interstitialVideo showAdFromViewController:self];
}
Discard video ads that are no longer needed.
Swift
self.interstitialVideo.releaseAd()
Objective-C
[self.interstitialVideo releaseVideoAd];
Please implement the following option as necessary.
- Set mute state to play video
- Display Fullscreen Ads
- Fullscreen Ad's background color outside Safe Area
- Receive notification
Set mute to play video using isMuteStartPlaying
property.
And default value is true
.
Swift
self.interstitialVideo.isMuteStartPlaying = false
Objective-C
self.interstitialVideo.isMuteStartPlaying = NO;
If you can not display interstitial video for reasons such as out of stock, you can display fullscreen ads on full screen instead. In order to use this function, you need to register ad space of fullscreen ads separately on the management screen.
Swift
self.interstitialVideo.addFallbackFullboard(withSpotID: spotID, apiKey: "apiKey")
Objective-C
[self.interstitialVideo addFallbackFullboardWithSpotID:spotID apiKey:@"apiKey"];
You can change the Fullscreen Ad's background color outside iPhoneX Safe Area
more affinitive to your app looking & feeling.
Swift
self.interstitialVideo.fallbackFullboardBackgroundColor = UIColor.white
Objective-C
self.interstitialVideo.fallbackFullboardBackgroundColor = [UIColor whiteColor];
You can use NADInterstitialVideoDelegate
to receive notification about each process of interstitial video.
Interactive ads (NADVideoAdTypePlayable) can't receive messages from a Delegate when the video ads were played or stopped or finished. |
Normal Video ads (NADVideoAdTypeNormal) can use Delegate to receive messages when the video ads were played or stopped or finished.
Interactive ads (NADVideoAdTypePlayable) is not video but working on the WebView.
Because of that, Interactive ads can't receive messages from a Delegate when the video ads were played or stopped or finished.
Swift
func nadInterstitialVideoAdDidReceiveAd(_ nadInterstitialVideoAd: NADInterstitialVideo!)
{
print("Interstitial Video Did Receive.")
}
Objective-C
- (void)nadInterstitialVideoAdDidReceiveAd:(NADInterstitialVideo *)nadInterstitialVideoAd
{
NSLog(@"Interstitial Video Did Receive.");
}
You can get ad type information by adType
property.
adType | Description |
---|---|
NADVideoAdTypeNormal |
Normal video ads |
NADVideoAdTypePlayable |
User-controllable ads |
Swift
func nadInterstitialVideoAdDidReceiveAd(_ nadInterstitialVideoAd: NADInterstitialVideo!) {
var adType: String
switch nadInterstitialVideoAd.adType {
case .normal:
adType = "normal"
case .playable:
adType = "playable"
default:
adType = "unknown"
}
print(#function + " : Ad Type = " + adType)
}
Objective-C
- (void)nadInterstitialVideoAdDidReceiveAd:(NADInterstitialVideo *)nadInterstitialVideoAd
{
NSString *adType;
switch (nadInterstitialVideoAd.adType) {
case NADVideoAdTypeNormal:
adType = @"normal";
break;
case NADVideoAdTypePlayable:
adType = @"playable";
break;
default:
adType = @"unknown";
break;
}
NSLog(@"%s : Ad Type = %@", __FUNCTION__, adType);
}
Swift
func nadInterstitialVideoAd(_ nadInterstitialVideoAd: NADInterstitialVideo!, didFailToLoadWithError error: Error!)
{
print("Interstitial Video Did Fail to Receive. error: \(error!)")
}
Objective-C
- (void)nadInterstitialVideoAd:(NADInterstitialVideo *)nadInterstitialVideoAd didFailToLoadWithError:(NSError *)error
{
NSLog(@"Interstitial Video Did Fail to Receive. error: %@", error);
}
Error code at load failure is as follows.
Code | Description |
---|---|
204 | No delivery ads |
400 | BAD request |
5XX | Server error |
600 | Error in SDK |
601 | Ad download failed |
602 | Fallback fullscreen ad failed |
603 | Invalid network |
604 | Advertisement acquisition network error (timeout etc.) |
605 | Received invalid response data |
Swift
func nadInterstitialVideoAdDidFailed(toPlay nadInterstitialVideoAd: NADInterstitialVideo!)
{
print("Interstitial Video Did Fail to Show.")
}
Objective-C
- (void)nadInterstitialVideoAdDidFailedToPlay:(NADInterstitialVideo *)nadInterstitialVideoAd
{
NSLog(@"Interstitial Video Did Fail to Show.");
}
Swift
func nadInterstitialVideoAdDidOpen(_ nadInterstitialVideoAd: NADInterstitialVideo!)
{
print("Interstitial Video Did Open.")
}
Objective-C
- (void)nadInterstitialVideoAdDidOpen:(NADInterstitialVideo *)nadInterstitialVideoAd
{
NSLog(@"Interstitial Video Did Open.");
}
Swift
func nadInterstitialVideoAdDidStartPlaying(_ nadInterstitialVideoAd: NADInterstitialVideo!)
{
print("Interstitial Video Did Start Playing.")
}
Objective-C
- (void)nadInterstitialVideoAdDidStartPlaying:(NADInterstitialVideo *)nadInterstitialVideoAd
{
NSLog(@"Interstitial Video Did Start Playing.");
}
Swift
func nadInterstitialVideoAdDidStopPlaying(_ nadInterstitialVideoAd: NADInterstitialVideo!)
{
print("Interstitial Video Did Stop Playing.")
}
Objective-C
- (void)nadInterstitialVideoAdDidStopPlaying:(NADInterstitialVideo *)nadInterstitialVideoAd
{
NSLog(@"Interstitial Video Did Stop Playing.");
}
Swift
func nadInterstitialVideoAdDidCompletePlaying(_ nadInterstitialVideoAd: NADInterstitialVideo!)
{
print("Interstitial Video Did Complete Playing.")
}
Objective-C
- (void)nadInterstitialVideoAdDidCompletePlaying:(NADInterstitialVideo *)nadInterstitialVideoAd
{
NSLog(@"Interstitial Video Did Complete Playing.");
}
Swift
func nadInterstitialVideoAdDidClose(_ nadInterstitialVideoAd: NADInterstitialVideo!)
{
print("Interstitial Video Did Close.")
}
Objective-C
- (void)nadInterstitialVideoAdDidClose:(NADInterstitialVideo *)nadInterstitialVideoAd
{
NSLog(@"Interstitial Video Did Close.");
}
Swift
func nadInterstitialVideoAdDidClickAd(_ nadInterstitialVideoAd: NADInterstitialVideo!)
{
print("Interstitial Video Did Click Ad.")
}
Objective-C
- (void)nadInterstitialVideoAdDidClickAd:(NADInterstitialVideo *)nadInterstitialVideoAd
{
NSLog(@"Interstitial Video Did Click Ad.");
}
Swift
func nadInterstitialVideoAdDidClickInformation(_ nadInterstitialVideoAd: NADInterstitialVideo!)
{
print("Interstitial Video Did Click Information.")
}
Objective-C
- (void)nadInterstitialVideoAdDidClickInformation:(NADInterstitialVideo *)nadInterstitialVideoAd
{
NSLog(@"Interstitial Video Did Click Information.");
}
In the test mode of video advertisement, it is necessary to register IDFA(Advertising Identifier) of the device on the management screen of nend.
IDFA value will be printed in debug logs when SDK Log level set over Info
& created NADInterstitialVideo
object.
-
v7.0.4 以降のバージョンから SKAdNetwork を使用した広告配信を行っております。最新版のSDKへのアップデートを推奨します。
更新履歴はこちらを参照ください。 -
iOS14以降では、広告の効果を測定するためにアプリに追加の設定を行う必要があります。
詳細はこちらを参照ください。 -
2023年9月1日より、SDK v6.0.0未満では動画広告の配信を停止いたします。新しいバージョンのご利用をご検討ください。
-
We recommend updating to latest version. v7.0.4 or higher it using advertise SKAdNetwork.
For details, please Release Notes. -
Need to configure the app for ad conversion tracking for iOS14.
For details, please check here. -
Effective September 1, 2023, we will stop serving video ads with SDK under v6.0.0. Please consider using a newer version.
- バナー型広告
- インタースティシャル広告
- ネイティブ広告
- フルボード広告
- 動画広告
- 動画ネイティブ広告
- Release Notes
- Preparation
- Supported Environments
- nendSDK Data Collection Items
- Privacy Policy
- About Information Button
- Add Manually
- Use CocoaPods
- Preparing for iOS14 or later
- When updating from nendSDK before version 3.2.2
- Banner Ad
- Interstitial Ad
- Native Ad
- Fullscreen Ad
- Video Ad
- Native Video Ad