OptiView Ads on React Native
The React Native integration is independently versioned. This guide targets react-native-theoplayer 11.4.0, while the OptiView Player SDK root is 11.6.1.
Prerequisites
- Obtain an OptiView Player license compatible with OptiView Ads from the player portal.
- Install
react-native-theoplayer11.4.0 and enable the THEOads platform feature.
- Android & Android TV
- iOS & tvOS
- Web
Set THEOplayer_extensionTHEOads = true in gradle.properties.
Add the THEOADS feature flag to react-native-theoplayer.json (or theoplayer-config.json).
npm install react-native-theoplayer@11.4.0
Load the Google DAI library:
<script src="https://imasdk.googleapis.com/js/sdkloader/ima3_dai.js"></script>
Integration
player.source = {
sources: {
src: 'CHANNEL-MONETIZED-HLS-URL',
type: 'application/x-mpegurl',
hlsDateRange: true,
},
ads: [
{
integration: 'theoads',
networkCode: 'NETWORK-CODE',
customAssetKey: 'CUSTOM-ASSET-KEY',
adTagParameters: { key: 'value' },
},
],
};
React Native supports adTagParameters, but does not expose breakManifestUrl. Use the platform's OptiView Player integration for Break Manifest handling and the channel's monetized HLS URL.
Verify
Load the channel's monetized HLS source and start playback. Confirm that the platform integration schedules a break from the Break Manifest or SSAI cues, the ad renders, and the OptiView impression appears in the portal.