Type function
Return value Boolean
Revision Current Public Release (2017.3068)
Keywords ads, advertising, vungle
See also ads.init()

Overview begins playing a full-screen video ad if one is cached and available for display.

For Vungle, this API returns a boolean true or false depending on the availability of a cached video ad.

Syntax adUnitType [, params] )
adUnitType (required)

String. Vungle supports the following types:

  • "interstitial" — default video ad unit
  • "incentivized" — video ad unit with optional server-to-server callback for in-app rewards
params (optional)

Table. A table that specifies properties for the ad request — see the next section for details.

Parameter Reference

The params table can include properties for the ad request.

isAnimated (optional)

Boolean. This parameter only applies to iOS. If true (default), the video ad will transition in with a slide effect. If false, it will appear instantaneously.

isAutoRotation (required)

Boolean. If true (default), the video ad will rotate automatically with the device's orientation. If false, it will use the ad's preferred orientation. This is required for Android only. For iOS, look into the orientations key.

orientations (optional)

Number. Bitmask with the possible orientation values. Default is UIInterfaceOrientationMaskAll.

isBackButtonEnabled (optional)

Boolean. This parameter only applies to Android. If true, the Android back button will stop playback of the video ad and display the post-roll. If false (default), the back button will be disabled during playback. Note that the back button is always enabled in the post-roll — when pressed, it exits the ad and returns to the application.

isSoundEnabled (optional)

Boolean. If true (default), sound will be enabled during video ad playback, subject to the device's sound settings. If false, video playback will begin muted. Note that the user can mute or un-mute sound during playback.

username (optional)

String. This parameter only applies to the "incentivized" ad unit type. When specified, it represents the user identifier that you wish to receive in a server-to-server callback that rewards the user for a completed video ad view.


local ads = require( "ads" )

local function adListener( event )
    if ( event.type == "adStart" and event.isError ) then
        --Cached video ad not available for display

ads.init( "vungle", "myAppId", adListener )

local adShown = "interstitial", { isAnimated=false, isBackButtonEnabled=true } )