# 전면 비디오 광고

## 1. 전면 비디오 광고 인스턴스 생성

아래 코드를 추가하여 전면 비디오 광고 인스턴스를 생성합니다.

{% tabs %}
{% tab title="JAVA" %}

```java
private AdPopcornSSPInterstitialVideoAd interstitialVideoAd;

@Override
protected void onCreate(Bundle savedInstanceState) {
    interstitialVideoAd= new AdPopcornSSPInterstitialVideoAd (context);
}
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
private var interstitialVideoAd: AdPopcornSSPInterstitialVideoAd? = null
     	
override fun onCreate(savedInstanceState: Bundle?) {
	 	interstitialVideoAd = AdPopcornSSPInterstitialVideoAd(this@MainActivity)
}
```

{% endtab %}
{% endtabs %}

## 2. 전면 비디오 광고 Placament ID 설정

아래 코드를 추가하여 전면 비디오  광고의 PLACEMENT ID 를 설정합니다. 전면 비디오 광고 PLACEMENT ID 는 [애드팝콘 SSP 콘솔](https://www.console.adpopcorn.com/)에서 생성이 가능합니다.

{% tabs %}
{% tab title="JAVA" %}

```java
interstitialVideoAd.setPlacementId("전면_비디오_PlacementId");
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
interstitialVideoAd?.placementId = "전면PlacementId"
```

{% endtab %}
{% endtabs %}

## 3. 네트워크 스케쥴 타임아웃 설정

AdPopcornSSP 에서 제공하는 전면 비디오 광고에 대한 네트워크 스케쥴 타임아웃을 설정합니다.

전면 비디오 광고 로딩 시 각 네트워크 별로 타임아웃 시간을 주어 해당 시간 안에 광고를 받지 못할 경우 , 다음 네트워크로 넘어가게 됩니다.

{% hint style="info" %}
Default 값은 10초 입니다.
{% endhint %}

{% tabs %}
{% tab title="JAVA" %}

```java
interstitialVideoAd.setNetworkScheduleTimeout(10);
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
interstitialVideoAd?.setNetworkScheduleTimeout(10)
```

{% endtab %}
{% endtabs %}

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

전면 광고 노출을 원하는 시점에 <mark style="color:red;">`loadAd()`</mark>API를 호출하여 서버에 광고를 요청 합니다.

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

{% tabs %}
{% tab title="JAVA" %}

```java
interstitialVideoAd.loadAd();
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
interstitialVideoAd?.loadAd()
```

{% endtab %}
{% endtabs %}

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

전면 광고 노출 시점에 <mark style="color:red;">`showAd()`</mark> API를 추가하여 광고를 재생 합니다.

{% tabs %}
{% tab title="JAVA" %}

```java
interstitialVideoAd.showAd();
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
interstitialVideoAd?.showAd()
```

{% endtab %}
{% endtabs %}

## 6. 전면 비디오 광고 이벤트 리스너

전면 비디오 광고에서 발생하는 이벤트에 대한 리스너를 설정 합니다. 제공되는 이벤트 리스너와 구현 예시는 아래와 같습니다.

| 이벤트 리스너                                                 | 설명                                                          |
| ------------------------------------------------------- | ----------------------------------------------------------- |
| OnInterstitialVideoAdLoaded()                           | 비디오 광고 로딩 성공                                                |
| OnInterstitialVideoAdLoadFailed(SSPErrorCode errorCode) | 비디오 광고 로딩 실패. [에러코드 값](/ssp-sdk/sdk/android/undefined-9.md) |
| OnInterstitialVideoAdOpened()                           | 비디오 광고 노출 성공                                                |
| OnInterstitialVideoAdOpenFalied()                       | 비디오 광고 노출 실패                                                |
| OnInterstitialVideoAdClosed()                           | 비디오 광고 닫기                                                   |
| OnInterstitialVideoAdClicked()                          | 비디오 광고 클릭(일부 미디에이션 광고는 지원 안함)                               |

{% tabs %}
{% tab title="JAVA" %}

```java
interstitialVideoAd.setEventCallbackListener(new IInterstitialVideoAdEventCallbackListener() { 

	@Override 
	public void OnInterstitialVideoAdLoaded() { 
	} 

	@Override 
	public void OnInterstitialVideoAdLoadFailed(SSPErrorCode errorCode) { 
	} 

	@Override 
	public void OnInterstitialVideoAdOpened() { 
	} 

	@Override 
	public void OnInterstitialVideoAdOpenFalied() { 
	} 

	@Override 
	public void OnInterstitialVideoAdClosed() { 
	}

	@Override 
	public void OnInterstitialVideoAdClicked() { 
	}

});
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
interstitialVideoAd?.setEventCallbackListener(object: IInterstitialVideoAdEventCallbackListener {

    override fun OnInterstitialVideoAdLoaded() {
    }

    override fun OnInterstitialVideoAdLoadFailed(errorCode: SSPErrorCode) {
    }

    override fun OnInterstitialVideoAdOpened() {
    }

    override fun OnInterstitialVideoAdOpenFalied() {
    }

    override fun OnInterstitialVideoAdClosed() {
    }

})
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: 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:

```
GET https://adpopcornssp.gitbook.io/ssp-sdk/sdk/android/undefined-3.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
