Skip to content

SDK 4.x Events ​

Upcoming: not released yet

TruexAdRenderer-tvOS 4.x is not released yet. For the current release, see SDK 3.x Events.

TruexAdRenderer tells your app about the ad lifecycle by calling methods of its TruexAdRendererDelegate. The methods your app needs for a working integration are:

MethodTerminalCalled for
onAdCompletedYesTrueX and IDVx
onAdErrorYesTrueX and IDVx
onNoAdsAvailableYesTrueX and IDVx
onUserCancelStreamYesTrueX and IDVx
onAdFreePodTrueX only

Event Flow ​

A typical TrueX ad where the user opts in and earns the reward:

◆  [User opts in and interacts with the ad]
│     ↓
◇  onAdFreePod
│     ↓
◇  onAdCompleted

An IDVx ad has no choice card and no reward, so it ends with onAdCompleted and never calls onAdFreePod.

Terminal Events ​

A terminal event means the renderer is done, and your app must continue playback - see Handling Terminal Events for what to do in each case. After a terminal event, call stop and remove all references to the renderer instance.

onAdCompleted ​

swift
func onAdCompleted(_ timeSpent: TimeInterval)
objective-c
- (void)onAdCompleted:(NSTimeInterval)timeSpent;

Terminal event. Called when the ad is finished, for example when:

  • the TrueX user chooses the normal video ads, or the choice card countdown runs out
  • the TrueX user completes the ad and exits it
  • an IDVx ad ends

The parameters are:

  • timeSpent: time in seconds the user spent in the ad

If onAdFreePod was called before, skip all remaining ads in the pod. Otherwise, continue with the next ad.

onAdError ​

swift
func onAdError(_ errorMessage: String)
objective-c
- (void)onAdError:(NSString *)errorMessage;

Terminal event. Called when the renderer hits an unrecoverable error. Handle it like onAdCompleted without onAdFreePod.

onNoAdsAvailable ​

swift
func onNoAdsAvailable()
objective-c
- (void)onNoAdsAvailable;

Terminal event. Called when there is no ad available for this user. Handle it like onAdCompleted without onAdFreePod.

onUserCancelStream ​

swift
func onUserCancelStream()
objective-c
- (void)onUserCancelStream;

Terminal event. Called when the user closes the Infillion ad because they want to exit the stream. Handle it like any other exit from your player - usually by returning the user to the episode or series page.

Reward Event ​

onAdFreePod ​

swift
func onAdFreePod()
objective-c
- (void)onAdFreePod;

Called when a TrueX user has earned the reward. Do not resume or seek yet - remember that it was called, and when the terminal onAdCompleted arrives, skip all remaining ads in the pod.

IDVx ads never call this method.

Integration documentation for Infillion Ads