> For the complete documentation index, see [llms.txt](https://adpopcornssp.gitbook.io/ssp-sdk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://adpopcornssp.gitbook.io/ssp-sdk/sdk/ios/ios-2.x.x/undefined-3.md).

# 전면 비디오 광고

&#x20;

## 1. 인스턴스 생성

{% tabs %}
{% tab title="Objective-C" %}
광고를노출하고자 하는 ViewController.m에 AdPopcornSSPInterstitialVideoAd.h를 import 하고 인스턴스 변수를 선언 합니다.

```objectivec
#import <AdPopcornSSP/AdPopcornSSPInterstitialVideoAd.h>
					
@interface AdPopcornSSPInterstitialVideoADViewController () <AdPopcornSSPInterstitialVideoAdDelegate>	
{										
    AdPopcornSSPInterstitialVideoAd *_sspInterstitialVideoAd;					
} 										
@end	

```

{% endtab %}

{% tab title="Swift" %}
광고를 노출하고자 하는 ViewController.swift 에 AdPopcornSSPInterstitialVideoAd 인스턴스 변수를 생성합니다.

```swift
class ViewController: UIViewController, APSSPInterstitialVideoAdDelegate
{	
    // InterstitialVideoAd
    var interstitialVideoAd: AdPopcornSSPInterstitialVideoAd!
}

```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Objective-C" %}
ViewController.m 을 수정하여 생성한 인스턴스를 구현 합니다.

```objectivec
@implementation AdPopcornSSPInterstitialVideoADViewController () 					
- (void) viewDidLoad									
{										
    _sspInterstitialVideoAd = [[AdPopcornSSPInterstitialVideoAd alloc] initWithKey: @"YOUR_APP_KEY" placementId: @"YOUR_PLACEMENT_Id" viewController:self];							
} 
@end
```

{% endtab %}

{% tab title="Swift" %}
ViewController.swift 을 수정하여 생성한 인스턴스를 구현합니다.

```swift
class ViewController: UIViewController, APSSPInterstitialVideoAdDelegate
{	
    // InterstitialVideoAd
    var interstitialVideoAd: AdPopcornSSPInterstitialVideoAd!
    
    override func viewDidLoad() {
        super.viewDidLoad()
	interstitialVideoAd= AdPopcornSSPInterstitialVideoAd.init(key: "YOUR_APP_KEY", 
	placementId: "YOUR_PLACEMENT_Id", viewController: self)        
    }
}

```

{% endtab %}
{% endtabs %}

### 1) Placement ID 변경

전면 비디오 인스턴스 생성 시 사용한 placementID를 변경하고자 할 경우, 아래와 같은 방식으로 변경합니다.

{% tabs %}
{% tab title="Objective-C" %}

```objectivec
_sspInterstitialVideoAd.placementId = @"변경하고자 할 ID";
```

{% endtab %}

{% tab title="Swift" %}

```
interstitialVideoAd.placementId = @"변경하고자 할 ID"
```

{% endtab %}
{% endtabs %}

## 2. 전면 비디오 광고 요청

<mark style="color:red;">`loadRequest`</mark> API를 호출 하여 전면 비디오 광고를 불러옵니다.

{% tabs %}
{% tab title="Objective-C" %}

```objectivec
[_sspInterstitialVideoAd loadRequest];
```

{% endtab %}

{% tab title="Swift" %}

```swift
interstitialVideoAd.loadRequest()
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
loadRequst 호출에 대한 결과로 광고 수신에 실패한 경우에는 loadAd 재호출을 하시면 안됩니다. 과도한 광고 요청 api 호출은 block 사유가 됩니다.
{% endhint %}

## 3. 전면 비디오 광고 노출

{% tabs %}
{% tab title="Objective-C" %} <mark style="color:red;">`presentFromViewController`</mark> API를 호출하여 전면 비디오 광고를 불러옵니다.

```objectivec
[_sspInterstitialVideoAd presentFromViewController:self];
```

{% endtab %}

{% tab title="Swift" %} <mark style="color:red;">`present`</mark> API를 호출하여 전면 비디오 광고를 불러옵니다.

```swift
interstitialVideoAd.present(from:self)
```

{% endtab %}
{% endtabs %}

## 4. 델리게이트 설정

전면 비디오 광고에서 발생하는 이벤트에 대한 델리게이트를 제공 합니다. 델리게이트를 사용하기 위해서는 <mark style="color:red;">`APSSPInterstitialVideoAdDelegate`</mark>를 추가 하여야 합니다.

\_sspInterstitialVideoAd 인스턴스에 delegate를 설정하고 구현하여야 합니다.

{% tabs %}
{% tab title="Objective-C" %}

| delegate                                | 설명                                                                 |
| --------------------------------------- | ------------------------------------------------------------------ |
| APSSPInterstitialVideoAdLoadSuccess     | 비디오광고 로드 성공                                                        |
| APSSPInterstitialVideoAdLoadFail, error | 비디오광고 로드 실패. [에러코드 값](/ssp-sdk/sdk/ios/ios-3.1.0+/undefined-12.md) |
| APSSPInterstitialVideoAdShowSuccess     | 비디오광고 노출 성공                                                        |
| APSSPInterstitialVideoAdShowFail        | 비디오광고 노출 실패                                                        |
| APSSPInterstitialVideoAdClosed          | 비디오광고 닫기                                                           |
| {% endtab %}                            |                                                                    |

{% tab title="Swift" %}

| delegate                                | 설명                                                                 |
| --------------------------------------- | ------------------------------------------------------------------ |
| apsspInterstitialVideoAdLoadSuccess     | 비디오광고 로드 성공                                                        |
| apsspInterstitialVideoAdLoadFail(error) | 비디오광고 로드 실패. [에러코드 값](/ssp-sdk/sdk/ios/ios-3.1.0+/undefined-12.md) |
| apsspInterstitialVideoAdShowSuccess     | 비디오광고 노출 성공                                                        |
| apsspInterstitialVideoAdShowFail        | 비디오광고 노출 실패                                                        |
| apsspInterstitialVideoAdClosed          | 비디오광고 닫기                                                           |
| {% endtab %}                            |                                                                    |
| {% endtabs %}                           |                                                                    |

{% tabs %}
{% tab title="Objective-C" %}

```objectivec
#import "AdPopcornSSPInterstitialVideoADViewController.h
						
@interface AdPopcornSSPInterstitialVideoADViewController() <APSSPInterstitialVideoAdDelegate>		
@end											
											
@implementation AdPopcornSSPInterstitialVideoADViewController						
											
- (void)viewDidLoad {																			
    [super viewDidLoad];												
    // 전면 비디오 광고 델리게이트 설정								
    _sspInterstitialVideoAd.delegate = self;								
}											
											
// 전면 비디오 광고 델리게이트 구현									
- (void)APSSPInterstitialVideoAdLoadSuccess:(AdPopcornSSPInterstitialVideoAD *)interstitialVideoAd;						
{													
   [_sspInterstitialVideoAd presentFromViewController:self];						
}											
											
- (void)APSSPInterstitialVideoAdLoadFail:(AdPopcornSSPInterstitialVideoAd *)interstitialVideoAd error:(AdPopcornSSPError)error			
{														
}	
										
- (void)APSSPInterstitialVideoAdShowSuccess:(AdPopcornSSPInterstitialVideoAD *)interstitialVideoAd				
{													
}		
									
- (void)APSSPInterstitialVideoAdShowFail:(AdPopcornSSPInterstitialVideoAd *)interstitialVideoAd							
{												
}	
										
- (void)APSSPInterstitialVideoAdClosed:(AdPopcornSSPInterstitialVideoAD *)interstitialVideoAd							
{													
}													
@end	
```

{% endtab %}

{% tab title="Swift" %}

```swift
class ViewController: UIViewController, APSSPInterstitialVideoAdDelegate
{	
    // InterstitialVideoAd
    var interstitialVideoAd: AdPopcornSSPInterstitialVideoAd!
    
    override func viewDidLoad() {
	super.viewDidLoad()
	interstitialVideoAd= AdPopcornSSPInterstitialVideoAd.init(key: "YOUR_APP_KEY", 
	placementId: "YOUR_PLACEMENT_Id", viewController: self)        
    }

    // InterstitialVideoAd Delegate
    func apsspInterstitialVideoAdLoadSuccess(_ interstitialVideoAd: AdPopcornSSPInterstitialVideoAd!) {
    }
    func apsspInterstitialVideoAdLoadFail(_ interstitialVideoAd: AdPopcornSSPInterstitialVideoAd!, error: AdPopcornSSPError!) {
    }
    func apsspInterstitialVideoAdShowSuccess(_ interstitialVideoAd: AdPopcornSSPInterstitialVideoAd!) {
    }
    func apsspInterstitialVideoAdShowFail(_ interstitialVideoAd: AdPopcornSSPInterstitialVideoAd!) {
    }
    func apsspInterstitialVideoAdClosed(_ interstitialVideoAd: AdPopcornSSPInterstitialVideoAd!) {
    }
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://adpopcornssp.gitbook.io/ssp-sdk/sdk/ios/ios-2.x.x/undefined-3.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
