收藏
回答

激励广告rewardedVideoAd.onClose无法找到?

报错内容:
VM346 WAService.js:2 
ReferenceError: rewardedVideoAd is not defined
    at se.onLoad (shejiweb.js? [sm]:39)
    at se.<anonymous> (VM346 WAService.js:2)
    at se.c.__callPageLifeTime__ (VM346 WAService.js:2)
    at Le (VM346 WAService.js:2)
    at Ye (VM346 WAService.js:2)
    at Function.<anonymous> (VM346 WAService.js:2)
    at i.<anonymous> (VM346 WAService.js:2)
    at i.emit (VM346 WAService.js:2)
    at Object.emit (VM346 WAService.js:2)
    at i.<anonymous> (VM346 WAService.js:2)

代码:
onLoad:function(options){
    console.log(options)
    var that = this
    var wangye_id = options.wangye_id;
    const db = wx.cloud.database()
    db.collection('sheji').doc(wangye_id).get({
      success:function(res){
        console.log(res.data)
        that.setData({
          listshuzu:res.data
        })
      }
    })

    if (wx.createRewardedVideoAd) {
      videoAd = wx.createRewardedVideoAd({
        adUnitId'adunit-2ff83af25aca3842'
      })
      videoAd.onLoad(() => {})
      videoAd.onError((err) => {})
      videoAd.onClose((res) => {})
    }

    rewardedVideoAd.onClose(res => {
      // 用户点击了【关闭广告】按钮
      if (res && res.isEnded) {
        // 正常播放结束,可以下发游戏奖励
        this.setData({
          view:true
        })
      } else {
        // 播放中途退出,不下发游戏奖励
      }
  })
  },

请问各位大神,广告关闭无法识别具体关闭的情况,太难了。
回答关注问题邀请回答
收藏
登录 后发表内容
问题标签