Appearance
Getting Started
This guide will help you add the TrueX Ad Renderer to your existing FireTV app's advertising setup.
Installation
Install the TrueX Ad Renderer for Vega and its required dependencies.
Install the Package
Using npm:
bashnpm install --save @truex/ad-renderer-vegaPeer Dependencies
The TrueX Ad Renderer requires specific peer dependencies. Install all required packages:
bashnpm install \ @amazon-devices/react-native-device-info@~2.0.0 \ @amazon-devices/webview@~3.3.0Verify Installation
After installation, verify that the package is correctly installed:
bashnpm list @truex/ad-renderer-vegaYou should see output similar to:
your-app@1.0.0 └── @truex/ad-renderer-vega@x.x.x
Basic Usage
Learn how to integrate the TrueX Ad Renderer component into your React Native application.
Import the Component
In your React Native component, import the TrueX Ad component:
typescript
import { TruexAd } from '@truex/ad-renderer-vega';Import Types
For TypeScript projects, import the type definitions:
typescript
import {
TruexAd,
TruexAdEvent,
TruexAdEventType,
TruexAdRendererOptions,
TruexAdProps
} from '@truex/ad-renderer-vega';Minimal Example
Here's the simplest way to render a TrueX ad:
tsx
import React, { useCallback } from 'react';
import { TruexAd, TruexAdEventType, TruexAdEventHandler } from '@truex/ad-renderer-vega';
function TruexAdContainer({ truexAdInfo, onTruexAdFinished, onTruexAdFreePod}) {
const handleTruexAdEvent = useCallback<TruexAdEventHandler>(
event: TruexAdEvent) => {
switch (event.type) {
case TruexAdEventType.AD_COMPLETED:
case TruexAdEventType.AD_ERROR:
case TruexAdEventType.NO_ADS_AVAILABLE:
case TruexAdEventType.USER_CANCEL_STREAM:
// Ad finished, resume content
onTruexAdFinished();
break;
case TruexAdEventType.AD_FREE_POD:
// User earned ad credit
onTruexAdFreePod()
break;
}
},
[ onTruexAdFinished, onTruexAdFreePod ]
);
// Parse the ad parameters from the VAST <AdParameters> node
const adParameters = JSON.parse(truexAdInfo.adParameters);
return (
<TruexAd
adParameters={adParams}
onAdEvent={handleTruexAdEvent}
/>
);
}
export default TruexAdContainer;Component Props
The TruexAd component accepts the following props:
Required Props
adParameters: An object containing the ad configuration. This object is obtained by parsing the JSON content of the<AdParameters>node from the VAST/VMAP response.onAdEvent: A callback function to handle ad lifecycle events.
tsx
// Parse the JSON string from the <AdParameters> node in your VAST response
const adParams = JSON.parse(adParametersStringFromVast);
<TruexAd
adParameters={adParams}
onAdEvent={handleTruexAdEvent}
/>Optional Props
options: Configuration options for the renderer.
tsx
import { TruexAdRendererOptions } from '@truex/ad-renderer-vega';
const options: TruexAdRendererOptions = {
supportsUserCancelStream: true,
appId: 'my-firetv-app',
enableWebViewDebugging: __DEV__
};
<TruexAd
adParameters={adParams}
options={options}
onAdEvent={handleTruexAdEvent}
/>Configuration Options
The options prop accepts a TruexAdRendererOptions object:
typescript
type TruexAdRendererOptions = {
supportsUserCancelStream?: boolean,
appId?: string,
enableWebViewDebugging?: boolean,
};supportsUserCancelStream
- Type:
boolean - Default:
false - Description: Enables the
USER_CANCEL_STREAMterminal event. When enabled, users can exit the entire stream from within the ad experience.
tsx
<TruexAd
adParameters={params}
onAdEvent={handleTruexAdEvent}
options={{ supportsUserCancelStream: true }}
/>appId
- Type:
string - Default:
undefined - Description: Your application identifier for reporting and analytics.
tsx
<TruexAd
adParameters={params}
onAdEvent={handleTruexAdEvent}
options={{ appId: 'my-firetv-app' }}
/>enableWebViewDebugging
- Type:
boolean - Default:
false - Description: Enables WebView debugging tools. Should only be enabled in development builds.
tsx
<TruexAd
adParameters={params}
onAdEvent={handleEvent}
options={{ enableWebViewDebugging: __DEV__ }}
/>Runtime Version Information
Access the TrueX Ad Renderer version at runtime:
tsx
import { buildInfo } from '@truex/ad-renderer-vega';
console.log(`Package: ${buildInfo.name}`); // Package: @truex/ad-renderer-vega
console.log(`Version: ${buildInfo.version}`); // Version: 0.7.1
console.log(`Date: ${buildInfo.date}`); // Date: 2025-12-04T16:06:55.046ZUnderstanding the Integration Flow
Before diving into code, it's helpful to understand the integration workflow:
- Video Playback - Your app plays video content
- Ad Break Detected - Video player encounters ad break (pre-roll/mid-roll)
- Pause Video & Show TrueX Ad - Pause playback, render TrueX component, hide controls
- User Interaction - User engages with interactive ad experience
- Terminal Event Received - Ad completion, error, or cancellation
- Resume Video Playback - Hide ad, resume video, skip remaining ads if credit earned
Key Integration Points
Your integration will involve:
- Ad Break Detection: Identifying when to show TrueX ads
- Component Rendering: Displaying the
<TruexAd>component - Event Handling: Responding to ad lifecycle events
- Video Control: Managing video playback state
- Ad Credit Tracking: Honoring earned ad-free viewing
What if I'm using a different video player?
The TrueX Ad Renderer is video-player agnostic. You'll need to integrate it with your specific player's API for pausing/resuming playback.
Is this only for FireTV?
The @truex/ad-renderer-vega package is specifically designed for Amazon Vega (FireTV). Other platforms have their own integration packages:

