Commit ad7b4738 authored by liuxinjun's avatar liuxinjun

视频广告多次注册事件问题

parent f4111a1a
......@@ -9,6 +9,7 @@ var adSdk = {
bannerAd: null,
isOnce:true,
videoAd: null,
videoAd1: null,
videoAd2: null,
......@@ -136,7 +137,12 @@ var adSdk = {
createRewardedVideoAd(index, videoAdUnitId1) {
let self = this;
if (cc.sys.platform === cc.sys.WECHAT_GAME) {
let videoAd = wx.createRewardedVideoAd({ adUnitId: videoAdUnitId1 })
if(self.isOnce)
{
self.isOnce=false;
videoAd.onLoad(function (res) {
console.log("sdk VideoAd广告加载事件:", res)
});
......@@ -157,10 +163,16 @@ var adSdk = {
videoAd.onClose(closeFun1);
videoAd.onError(function (res) {
wx.showToast({
title: '今日视频已上限,明日再来!',
icon: 'none'
});
if (self.videoError) {
self.videoError();
}
});
}
if (index == 1) {
this.videoAd1 = videoAd;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment