首页广告监听
if(uni.createRewardedVideoAd) {
var adid = XXX;
rewardedVideoAd = uni.createRewardedVideoAd({ adpid:adid})
rewardedVideoAd.onLoad(() => {
console.log('onLoad event')
})
rewardedVideoAd.onError((err) => {
console.log('onError event', err)
console.log(adid)
})
rewardedVideoAd.onClose((res) => {
console.log('首页 onClose event', res)
var _this = this;
// 用户点击了【关闭广告】按钮
if (res && res.isEnded) {
// 正常播放结束
} else {
// 播放中途退出
}
})
}
},
首页广告调起
insuffVideo: function() {
console.log("首页广告调起")
var _this = this;
if(_this.videotime ==0){
if(_this.video_num>0){
rewardedVideoAd.show()
.catch(() => {
rewardedVideoAd.load()
.then(() => rewardedVideoAd.show())
.catch(err => {
uni.showModal({
title:"提示",
content:"广告获取失败",
showCancel:false,
success() {
}
})
})
})
}else{
uni.showModal({
title:"提示",
content:"没有视频次数",
showCancel:false,
})
}
}else{
uni.showToast({
title: _this.videotime +'秒之后可以再次观看',
duration: 2000,
icon:"none",
});
}
},
转盘页面广告监听
if(uni.createRewardedVideoAd) {
rewardedVideoAd = uni.createRewardedVideoAd({ adpid: 'XXXXX' })
rewardedVideoAd.onLoad(() => {
console.log('onLoad event')
})
rewardedVideoAd.onError((err) => {
console.log('onError event', err)
})
rewardedVideoAd.onClose((res) => {
console.log('幸运转盘 onClose event', res)
var _this = this;
// 用户点击了【关闭广告】按钮
if (res && res.isEnded) {
} else {
// 播放中途退出
}
})
}
2***@qq.com (作者)
你解决了没有 感觉好绝望 完全没有解决思路...
2020-05-23 14:07