Type Function Return value none Revision Release 2024.3703 Keywords ads, advertising, Appnext, setVideoLength See also appnext.getVideoLength() appnext.*
Effects full-screen and rewarded ads only. Sets the video length to 15 or 30 seconds
appnext.setVideoLength( adKey, videoLength )
String. The ad key returned for a previously created ad.
String. The preferred video length to be set for the ad. Possible values are "15"
, "30"
, and "managed"
.
local appnext = require( "plugin.appnext" ) local function adListener( event ) print( "Received " .. event.event .. " for " .. event.adKey .. " with message: " .. event.message ) end -- Initialize the Appnext plugin appnext.init( adListener ) -- Create your ads local fullscreenPlacementID local platform = system.getInfo( "platformName" ) if ( platform == "iPhone OS" ) then fullscreenPlacementID = "YOUR_IOS_FULLSCREEN_PLACEMENT_ID" elseif ( platform == "Android" ) then fullscreenPlacementID = "YOUR_ANDROID_FULLSCREEN_PLACEMENT_ID" end local fullscreenAdKey = appnext.createAd( "fullscreen", fullscreenPlacementID ) appnext.setVideoLength( fullscreenAdKey, "30" )