appnext.setMute()

类型 函数
返回值
修订 版本 2024.3703
关键词 广告, Appnext, setMute
另请参阅 appnext.getMute()
appnext.*

概述

设置广告中播放的视频是否静音(默认为 false。在 iOS 上,仅对全屏和激励视频广告有效。

语法

appnext.setMute( adKey, mute )
adKey (必填)

字符串先前创建的广告返回的广告键。

mute (必填)

布尔值指示播放的视频是否静音。

示例

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.setMute( fullscreenAdKey, true )