diff --git a/docs/api/a-d/rewarded-video.md b/docs/api/a-d/rewarded-video.md index 77695cd4d559ee4bf5475a87b04f05a8b93f4c64..0dc059ec220cdd0c2b5d5fef4c74c38b594ee8a4 100644 --- a/docs/api/a-d/rewarded-video.md +++ b/docs/api/a-d/rewarded-video.md @@ -85,7 +85,7 @@ // AD.load(this._adpid) }, methods: { - show() { + showAd() { AD.show(this._adpid, (res) => { console.log("onclose") console.log(res) @@ -178,12 +178,15 @@ const ProviderType = { GDT: 'gdt' } +const RETRY_COUNT = 1 + class RewardedVideo { constructor(options = {}) { this._isLoad = false this._isLoading = false this._lastLoadTime = 0 this._lastError = null + this._retryCount = 0 this._loadCallback = null this._closeCallback = null @@ -201,10 +204,8 @@ class RewardedVideo { this._isLoad = false this.onClose(e) }) - rewardAd.onVerify && rewardAd.onVerify((e) => { - // this._dispatchEvent('verify', { - // isValid: e.isValid - // }) + rewardAd.onVerify((e) => { + // e.isValid }) rewardAd.onError(({ code, @@ -221,8 +222,13 @@ class RewardedVideo { return } - this._lastError = data + if (this._retryCount < RETRY_COUNT) { + this._retryCount += 1 + this._loadAd() + return + } + this._lastError = data this.onError(data) }) } @@ -252,6 +258,8 @@ class RewardedVideo { return } + this._retryCount = 0 + this._loadAd() }