类型 函数 返回值 无 修订版本 2024.3703 版 关键字 广告、宣传、Appnext、setVideoLength 另请参阅 appnext.getVideoLength() appnext.*
仅对全屏插屏广告有效。将视频长度设置为 15 秒或 30 秒
appnext.setVideoLength( adKey, videoLength )
字符串. 之前创建的广告返回的广告密钥。
字符串. 为广告设置的首选视频长度。可能的值为 "15"
、"30"
和 "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" )