|
@@ -554,10 +554,8 @@ export class SdkUtil {
|
|
|
SdkUtil.videoAd = tt.createRewardedVideoAd({adUnitId: _adUnitId});
|
|
|
break;
|
|
|
case config.Platform.WX:
|
|
|
- // uiManager.Instance().showLoading()
|
|
|
- // SdkUtil.videoAd = wx.createRewardedVideoAd({adUnitId: _adUnitId});
|
|
|
- call_back && call_back({"isEnded":true})
|
|
|
- return
|
|
|
+ uiManager.Instance().showLoading()
|
|
|
+ SdkUtil.videoAd = wx.createRewardedVideoAd({adUnitId: _adUnitId});
|
|
|
break;
|
|
|
case config.Platform.KS:
|
|
|
// uiManager.Instance().showLoading()
|
|
@@ -575,24 +573,45 @@ export class SdkUtil {
|
|
|
uiManager.Instance().hideLoading()
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
+ if(tools.platform == config.Platform.WX) {
|
|
|
+ // 取消关闭,取消错误,提示重复回调,造成奖励重复发送的问题或错误重复发送的问题
|
|
|
+ SdkUtil.videoAd.offClose()
|
|
|
+ SdkUtil.videoAd.offError()
|
|
|
+ SdkUtil.videoAd.load().then(()=>{
|
|
|
+ console.log("wx 广告加载完成");
|
|
|
+ SdkUtil.isLookAd = true
|
|
|
+ SdkUtil.videoAd.show()
|
|
|
+ setTimeout(()=>{
|
|
|
+ uiManager.Instance().hideLoading()
|
|
|
+ },1000)
|
|
|
+ }).catch(err=>{
|
|
|
+ console.error('wx 视频广告加载或展示失败:', err);
|
|
|
+ let errorString = err.errCode + '-' + err.errMsg
|
|
|
+ call_back && call_back({isEnded:false,errorString:errorString})
|
|
|
+ SdkUtil.isLookAd = false
|
|
|
+ uiManager.Instance().hideLoading()
|
|
|
+ })
|
|
|
+ }
|
|
|
if(tools.platform==config.Platform.KS) {
|
|
|
SdkUtil.videoAd.show().then(()=>{
|
|
|
console.log("ks 广告加载完成");
|
|
|
SdkUtil.isLookAd = true
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
- SdkUtil.videoAd.onLoad(() => {
|
|
|
- console.log("广告加载完成");
|
|
|
- SdkUtil.isLookAd = true
|
|
|
- SdkUtil.videoAd.show();
|
|
|
- });
|
|
|
+ if(tools.platform==config.Platform.TT) {
|
|
|
+ SdkUtil.videoAd.onLoad(() => {
|
|
|
+ console.log("tt 广告加载完成");
|
|
|
+ SdkUtil.isLookAd = true
|
|
|
+ SdkUtil.videoAd.show();
|
|
|
+ });
|
|
|
+ }
|
|
|
SdkUtil.videoAd.onClose((res) => {
|
|
|
console.log('广告关闭=',res)
|
|
|
uiManager.Instance().hideLoading()
|
|
|
SdkUtil.isLookAd = false
|
|
|
- SdkUtil.videoAd.destroy()
|
|
|
+ if(tools.platform!=config.Platform.WX) {
|
|
|
+ SdkUtil.videoAd.destroy() // 微信销毁后,再次获取广告,不会显示
|
|
|
+ }
|
|
|
call_back && call_back(res)
|
|
|
});
|
|
|
SdkUtil.videoAd.onError((res) => {
|
|
@@ -601,7 +620,9 @@ export class SdkUtil {
|
|
|
let errorString = res.errCode + '-' + res.errMsg
|
|
|
call_back && call_back({isEnded:false,errorString:errorString})
|
|
|
SdkUtil.isLookAd = false
|
|
|
- SdkUtil.videoAd.destroy()
|
|
|
+ if(tools.platform!=config.Platform.WX) {
|
|
|
+ SdkUtil.videoAd.destroy() // 微信销毁后,再次获取广告,不会显示
|
|
|
+ }
|
|
|
});
|
|
|
if(tools.platform==config.Platform.TT) {
|
|
|
SdkUtil.videoAd.load()
|