This project demonstrates how to integrate the Infillion ad renderer with various ad insertion mechanisms on iOS. Each integration is presented as a standalone screen accessible from the app's home menu.
- Xcode 15+
- iOS 16+
- Familiarity with AVPlayer and the relevant ad SDK for the integration you're looking at
Managed via Swift Package Manager:
- GoogleInteractiveMediaAds (v3.28.10) — IMA SDK for stream and ad management
- TruexAdRenderer-iOS (v4.1.0) — Infillion interactive ad renderer
- true[X] — An interactive opt-in ad that always appears at position 1 of the ad pod. It presents a choice card to the viewer. If they engage and complete the interaction, they earn true[ATTENTION] credit and the rest of the ad break is skipped. If they decline, fallback ads play instead.
- IDVx — A non-interactive ad that plays automatically without viewer input. It can appear at any position in the ad pod and integrates seamlessly alongside third-party ads.
Both are delivered through the TruexAdRenderer and identified at runtime by the ad's adSystem field (truex or idvx).
Server-side ad insertion via Google Ad Manager. The implementation lives in InfillionAdsRefAppiOS/SSAIGAMRef/.
Files:
SSAIGAMRefController.swift— stream setup, ad break handling, TrueX renderer lifecycleSSAIGAMRefController+VASTWorkaround.swift— prefetches VAST configs (workaround for limited GAM account access; not part of a standard integration)
Flow:
-
Request the SSAI stream — An
IMAVODStreamRequestis created with the content source and video IDs. IMA stitches ads into the stream. -
Detect Infillion ads — When
IMAStreamManagerDelegatefires a.STARTEDevent, the ad'sadSystemfield is checked fortruexoridvx. -
Start the engagement — Playback is paused,
TruexAdRendereris initialized with the ad parameters, andstartis called to present the interactive experience. -
Handle credit — If the viewer earns true[ATTENTION], the
onAdFreePoddelegate callback fires. The app records this so it can skip the remaining ad break when the renderer finishes. -
Handle completion — On
onAdCompleted,onAdError, oronNoAdsAvailable, the renderer is torn down and playback resumes. If credit was earned, the entire ad break is skipped; otherwise, fallback ads play normally.
Playback controls:
- Tap to show/hide play-pause and progress slider (auto-hides after 3 seconds)
- Seeking snaps back to the first unplayed ad cue point before the target position
- Already-played ad breaks are automatically skipped during normal playback
For the full Infillion iOS integration guide, see: https://socialvibe.github.io/infillion-ads-integration-docs/platforms/ios/
- Clone the repository
- Open
InfillionAdsRefAppiOS.xcodeprojin Xcode - Xcode will resolve Swift Package Manager dependencies automatically
- Build and run on a simulator or device