> 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/flutter/undefined-4.md).

# 리워드 비디오 광고

## 1. 광고 요청

<mark style="color:red;">`loadRewardVideo`</mark> API를 호출하여 리워드 비디오 광고를 요청합니다.

{% code title="Dart" %}

```dart
AdPopcornSSP.loadRewardVideo('your_app_key', 'your_placement_id');
```

{% endcode %}

## 2. 광고 노출

리워드 비디오 광고가 정상적으로 로딩 완료 된 후, 광고 노출을 하고자 하는 시점에 <mark style="color:red;">`showRewardVideo`</mark> API를 호출합니다.

{% code title="Dart" %}

```dart
AdPopcornSSP.showRewardVideo('your_app_key', 'your_placement_id');
```

{% endcode %}

## 3. 이벤트 연동

광고 요청, 노출에 대한 결과 이벤트를 받는 설정을 진행할 수 있습니다. 원하는 이벤트만 연동하여 사용하면 됩니다.

{% code title="Dart" %}

```dart
AdPopcornSSP.rewardVideoAdLoadSuccessListener = (placementId) {
};
AdPopcornSSP.rewardVideoAdLoadFailListener = (placementId, errorCode) {
};
AdPopcornSSP.rewardVideoAdShowSuccessListener = (placementId) {
};
AdPopcornSSP.rewardVideoAdShowFailListener = (placementId) {
};
AdPopcornSSP.rewardVideoAdClosedListener = (placementId) {
};
AdPopcornSSP.rewardVideoAdCompletedListener = (placementId, adNetworkNo, completed) {
};
AdPopcornSSP.rewardPlusCompletedListener = (result, resultCode, reward) {
};
```

{% endcode %}

| 이벤트                                           | 설명                                                            |
| --------------------------------------------- | ------------------------------------------------------------- |
| AdPopcornSSP.rewardVideoAdLoadSuccessListener | 리워드 비디오 로딩 성공                                                 |
| AdPopcornSSP.rewardVideoAdLoadFailListener    | 리워드 비디오 로딩 실패. [에러코드 값](/ssp-sdk/sdk/android/undefined-10.md) |
| AdPopcornSSP.rewardVideoAdShowSuccessListener | 리워드 비디오 노출                                                    |
| AdPopcornSSP.rewardVideoAdShowFailListener    | 리워드 비디오 노출 실패                                                 |
| AdPopcornSSP.rewardVideoAdClosedListener      | 리워드 비디오 닫기                                                    |
| AdPopcornSSP.rewardVideoAdCompletedListener   | 리워드 비디오 재생 완료                                                 |
| AdPopcornSSP.rewardPlusCompletedListener      | 보상형광고(리워드  플러스) 적립 요청 처리                                      |

## 6. 샘플 코드

{% code title="Dart" %}

```dart
AdPopcornSSP.loadRewardVideo('your_app_key', 'your_placement_id');
AdPopcornSSP.rewardVideoAdLoadSuccessListener = (placementId) {
   AdPopcornSSP.showRewardVideo('your_app_key', 'your_placement_id');
};
```

{% endcode %}
