Appearance
Examples
Three Roku reference apps show a complete integration of TrueX and IDVx ads, one for each way ads are inserted:
| Example | Ad source | Ad break behavior |
|---|---|---|
| CSAI without RAF | A VAST/VMAP response parsed by the app | The app schedules and plays the ad pod itself |
| RAF CSAI | A VMAP parsed by the Roku Advertising Framework (RAF) | RAF parses the response and plays the regular ads |
| Google IMA DAI | A Google DAI stream | Google DAI returns one stream with stitched ad breaks |
Each example has its own player, ad, and TruexAdRenderer code on purpose, so you can pick the one closest to your setup and read it from top to bottom. All three load the library the same way - see SDK Integration.
Running the Apps
Requirements:
- A Roku device in developer mode
- The app source from the repository below, sideloaded to the device
Test IP parameter
The TrueX ad server serves ads in the US and Canada only. If your team or CI runs outside those regions, ask your Infillion contact for the test ip parameter to add to the sample VAST tags. Do not use it in production.
Shared Rules
All three examples follow the same rules, implemented as small functions you can copy:
- An ad is an Infillion ad if its
<AdSystem>istrueXorIDVx, compared case-insensitively. - TrueX is interactive only as the first ad in the pod; at a later position it plays as a regular linear ad. IDVx is interactive in any position.
adParameterscomes from the ad (see ResolvingadParameters). If it is missing or invalid, the renderer is not started and the pod continues.- Only a TrueX ad that fired
adFreePodskips the rest of the pod afteradCompleted. userCancelStreamcloses the player screen.
CSAI without RAF
Repository: truex-roku-csai-reference-app
The app parses the VAST itself and plays the ad pod with its own player, without the Roku Advertising Framework.
- Load the library -
main-scene.xmldeclares theComponentLibraryandmain-scene.brswaits forloadStatusto beready. - Detect the ad -
playback-screen.brschecks the<AdSystem>value of each ad in the pod. - Resolve
adParameters- the generic<AdParameters>JSON, or the base64 companion payload. - Start the renderer - it creates
TruexLibrary:TruexAdRenderer, sendsinitandstart, and handles the events inonTruexEvent. - Continue the pod - after the terminal event, the app discards the rest of the pod after a TrueX
adFreePod, or starts the next ad in the pod.
RAF CSAI
Repository: truex-roku-raf-csai-reference-app
RAF parses the ad response, finds the ads, and plays the regular ads. The app only takes over for the Infillion ad.
- Set up RAF -
PlaybackTask.brsgives RAF the ad URL (a VMAP with TrueX ads in a preroll and a midroll pod). - Detect the ad -
handleAdPod()reads the pod withRoku_Ads().getAds()and classifies each ad. - Play the Infillion ad -
playTrueXAd()creates the renderer in the ad container passed by the flow, resolvesadParametersfrom the ad'sadParametersorcompanionAds, and waits for the terminal event. - Play the rest of the pod - if the user did not earn the reward,
Roku_Ads().showAds()plays the remaining ads. RAF owns the thread until the ads finish, so the app restores the content position afterwards.
Google IMA DAI
Repository: truex-roku-google-ad-manager-reference-app
The Google IMA SDK for Roku plays a DAI stream with the ads stitched into it. The integration is in ImaSdkTask.brs and ContentFlow.brs, and the code is marked with numbered comments that match the steps in the repository README:
- Keep track of the current ad break - save the break in the IMA
adBreakStartedcallback. - Look for the Infillion companion - in
onStreamStarted, inspect the ad's companions forapiFrameworktruex. - Parse
adParameters- decode the base64 companion payload into JSON. - Prepare to enter the ad - pause the stream and seek over the placeholder ad.
- Initialize and start the renderer - send
init, wait foradFetchCompleted, and sendstart. - Respond to
adFreePod- seek the stream over the current ad break. - Respond to the terminal events - resume playback after
adCompleted,adError, ornoAdsAvailable. - Respond to
userCancelStream- leave the stream.

