rewardedVideoAd = wx.createRewardedVideoAd({
adUnitId: 'xxxxxxx'
})
rewardedVideoAd.show().catch(() => {
rewardedVideoAd.load()
.then(() => rewardedVideoAd.show())
.catch(err => {
console.log(err)
console.log('激励视频 广告显示失败')
})
})
rewardedVideoAd.onLoad(() => {
console.log('onLoad event emit')
})
rewardedVideoAd.onError((err) => {
console.log('onError event emit', err)
})
rewardedVideoAd.onClose((res) => {
if (res && res.isEnded) {
// 正常播放结束,可以下发奖励
~------------------------
rewardedVideoAd.offClose() //--------------重点:清除上一次回调,避免产生重复回调
~----------------------------
//调用接口、处理逻辑
} else {
wx.showToast({
title: "失败",
icon: 'none',
duration: 3000
})
}
})
微信小程序多次观看激励视频
于 2023-02-02 14:47:45 首次发布