WASubContext.js?t=wechat&s=1676124460090&v=2.14.3:2 激励视频广告组件检测到您绑定了多次 onClose 事件,绑定重复的事件会产生多次重复的回调,请确认您绑定的事件是否重复,以免造成事件重复回调问题。
小程序激励视频广告多次回调问题(offColse问题)
小程序观看多个广告视频,提示重复回调,造成奖励重复发送的问题
let videoAd = tt.createRewardedVideoAd({
adUnitId: "你的广告id",
});
try{
if(videoAd.closeHandler){
videoAd.offClose(videoAd.closeHandler);
console.log("videoAd.offClose卸载成功");
}
} catch (e) {
console.log("videoAd.offClose 卸载失败");
console.error(e);
}
videoAd.closeHandler= function (res) {
// 用户点击了【关闭广告】按钮
if (res && res.isEnded || res === undefined) {
// 正常播放结束,可以下发游戏奖励
console.log("播放完毕");
} else {
//提前关闭小程序
}
};
videoAd.onClose(videoAd.closeHandler);