Skip to content

Commit

Permalink
docs: add ads section (#3502)
Browse files Browse the repository at this point in the history
  • Loading branch information
KrzysztofMoch authored Jan 28, 2024
1 parent 135d97c commit 2094dbd
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/pages/component/_meta.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"props": "Properties",
"drm": "DRM",
"ads": "Ads",
"events": "Events",
"methods": "Methods"
}
25 changes: 25 additions & 0 deletions docs/pages/component/ads.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Ads

## IMA SDK
`react-native-video` has built-in support for Google IMA SDK for Android and iOS. To enable it please refer to [installation section](/installation)

### Usage
To use AVOD, you need to pass `adTagUrl` prop to `Video` component. `adTagUrl` is a VAST uri.

Example:
```
adTagUrl="https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/vmap_ad_samples&sz=640x480&cust_params=sample_ar%3Dpremidpostoptimizedpodbumper&ciu_szs=300x250&gdfp_req=1&ad_rule=1&output=vmap&unviewed_position_start=1&env=vp&impl=s&cmsid=496&vid=short_onecue&correlator="
```

> NOTE: Video ads cannot start when you are using the PIP on iOS (more info available at [Google IMA SDK Docs](https://developers.google.com/interactive-media-ads/docs/sdks/ios/client-side/picture_in_picture?hl=en#starting_ads)). If you are using custom controls, you must hide your PIP button when you receive the ```STARTED``` event from ```onReceiveAdEvent``` and show it again when you receive the ```ALL_ADS_COMPLETED``` event.
### Events
To receive events from IMA SDK, you need to pass `onReceiveAdEvent` prop to `Video` component. List of events, you can find [here](https://github.com/react-native-video/react-native-video/blob/master/src/types/Ads.ts)

Example:

```jsx
...
onReceiveAdEvent={event => console.log(event)}
...
```
2 changes: 1 addition & 1 deletion docs/pages/component/props.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Example:
adTagUrl="https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/vmap_ad_samples&sz=640x480&cust_params=sample_ar%3Dpremidpostoptimizedpodbumper&ciu_szs=300x250&gdfp_req=1&ad_rule=1&output=vmap&unviewed_position_start=1&env=vp&impl=s&cmsid=496&vid=short_onecue&correlator="
```

Note: On android, you need enable IMA SDK in gradle file, see: [enable client side ads insertion](#enable-client-side-ads-insertion)
Note: You need enable IMA SDK in gradle or pod file - [enable client side ads insertion](/installation)


Platforms: Android, iOS
Expand Down

0 comments on commit 2094dbd

Please sign in to comment.