2***@qq.com
2***@qq.com
  • 发布:2020-05-23 11:59
  • 更新:2020-07-14 19:06
  • 阅读:795

【报Bug】激励视频广告关闭进入其他页面的回调

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: win 7 旗舰版

HBuilderX类型: 正式

HBuilderX版本号: 2.7.5

手机系统: Android

手机系统版本号: Android 10

手机厂商: 小米

手机机型: 小米10

页面类型: vue

打包方式: 云端

项目创建方式: HBuilderX

App下载地址或H5⽹址: http://app.gtfei.cn/app.php/Mzk=

示例代码:

首页广告监听

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 {  
                          // 播放中途退出  
                        }  
                })  
            }

操作步骤:

在首页调起广告组件 广告结束时关闭

预期结果:

执行首页广告监听的回调

实际结果:

执行转盘页面监听的回调

bug描述:

广告组件 广告关闭时 偶尔进入其他页面的监听事件中

2020-05-23 11:59 负责人:DCloud_Android_zl 分享
已邀请:
1***@qq.com

1***@qq.com

我也遇到过这样的问题

  • 2***@qq.com (作者)

    你解决了没有 感觉好绝望 完全没有解决思路...

    2020-05-23 14:07

DCloud_uniAD_HDX

DCloud_uniAD_HDX

Bug已确认,在Android上有问题,下版修复,当前版本解决方案:当前激活的页面重新创建广告

DCloud_uniAD_HDX

DCloud_uniAD_HDX

HBuilderX 2.7.12+ 已修复

该问题目前已经被锁定, 无法添加新回复