This project demonstrates how to integrate the Infillion ad renderer with various ad insertion mechanisms on tvOS. Each integration is presented as a standalone screen accessible from the app's home menu.
- Xcode 15+
- tvOS 17+
- Familiarity with AVPlayer and the relevant ad SDK for the integration you're looking at
Managed via Swift Package Manager:
- GoogleInteractiveMediaAds-tvOS (v4.16.0) — IMA SDK for stream and ad management
- TruexAdRenderer-tvOS (v4.6.29) — 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 InfillionAdsRefAppTvOS/SSAIGAMRef/.
Files:
SSAIGAMRefController.swift— stream setup, ad break handling, TrueX renderer lifecycleSSAIGAMRef.storyboard— view controller layout with a centered activity spinner
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:
- The system
AVPlayerViewControlleris presented modally and handles all remote input - Seeking snaps back to the first unplayed ad cue point before the target position
- Already-played ad breaks are automatically skipped during normal playback
- Pressing Menu dismisses the player and returns to the home screen
For the full Infillion tvOS integration guide, see the integration docs.
- Clone the repository
- Open
InfillionAdsRefAppTvOS.xcodeprojin Xcode - Xcode will resolve Swift Package Manager dependencies automatically
- Build and run on a simulator or device