Commit ad7b4738 authored by liuxinjun's avatar liuxinjun

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

parent f4111a1a
...@@ -9,6 +9,7 @@ var adSdk = { ...@@ -9,6 +9,7 @@ var adSdk = {
bannerAd: null, bannerAd: null,
isOnce:true,
videoAd: null, videoAd: null,
videoAd1: null, videoAd1: null,
videoAd2: null, videoAd2: null,
...@@ -136,7 +137,12 @@ var adSdk = { ...@@ -136,7 +137,12 @@ var adSdk = {
createRewardedVideoAd(index, videoAdUnitId1) { createRewardedVideoAd(index, videoAdUnitId1) {
let self = this; let self = this;
if (cc.sys.platform === cc.sys.WECHAT_GAME) { if (cc.sys.platform === cc.sys.WECHAT_GAME) {
let videoAd = wx.createRewardedVideoAd({ adUnitId: videoAdUnitId1 }) let videoAd = wx.createRewardedVideoAd({ adUnitId: videoAdUnitId1 })
if(self.isOnce)
{
self.isOnce=false;
videoAd.onLoad(function (res) { videoAd.onLoad(function (res) {
console.log("sdk VideoAd广告加载事件:", res) console.log("sdk VideoAd广告加载事件:", res)
}); });
...@@ -157,10 +163,16 @@ var adSdk = { ...@@ -157,10 +163,16 @@ var adSdk = {
videoAd.onClose(closeFun1); videoAd.onClose(closeFun1);
videoAd.onError(function (res) { videoAd.onError(function (res) {
wx.showToast({
title: '今日视频已上限,明日再来!',
icon: 'none'
});
if (self.videoError) { if (self.videoError) {
self.videoError(); self.videoError();
} }
}); });
}
if (index == 1) { if (index == 1) {
this.videoAd1 = videoAd; 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