tencent cloud

All product documents
Tencent Cloud Super App as a Service
Rewarded Video Ad
Last updated: 2025-04-09 18:35:50
Rewarded Video Ad
Last updated: 2025-04-09 18:35:50
The rewarded video ad component is composed of native image, text, and video controls from the client. It has the highest layer level and will cover full-screen Canvas elements.
Developers can call wx.createRewardedVideoAd to create a rewarded video ad component. This method returns a global singleton.
let video1 = wx.createRewardedVideoAd({ adUnitId: 'xxxx' })
let video2 = wx.createRewardedVideoAd({ adUnitId: 'xxxx' })
console.log(video1 === video2)
// true
The rewarded video ad component is hidden by default, allowing it to be pre-created for early initialization.
let rewardedVideoAd = wx.createRewardedVideoAd({ adUnitId: 'xxxx' })
To avoid misuse of ad resources, each user is limited to a certain number of rewarded video ads per day. It is recommended to check if the ad has been successfully fetched before displaying the ad button.

Show/Hide

By default, the rewarded video ad component is hidden. You need to call RewardedVideoAd.show() to display it.
rewardedVideoAd.show()
The rewarded video ad component can only be closed when the user taps the close button. Developers cannot control the hiding of the rewarded video ad component.

Fetch success and failure

The rewarded video ad component automatically fetches ads and refreshes them. It fetches an ad upon the component creation and fetches the next ad after the user taps the close button.
If the ad is fetched successfully, RewardedVideoAd.onLoad() will be executed. The Promise returned by RewardedVideoAd.show() will also be a resolved Promise. Neither of these callback functions receives any parameters.
rewardedVideoAd.onLoad(() => {
console.log('rewardedVideoAd load')
})

rewardedVideoAd.show()
.then(() => console.log('rewardedVideoAd show'))
If the ad fails to fetch, the callback function registered with RewardedVideoAd.onError() will be executed, and the parameter of the callback function is an object containing failure information.Common error codes.
rewardedVideoAd.onError(err => {
console.log(err)
})
The Promise returned by RRewardedVideoAd.show() will also be a rejected Promise.
rewardedVideoAd.show()
.catch(err => console.log(err))

Retry on fetch failure

If the component fails to fetch the ad automatically, subsequent calls to show() will be rejected. You can now call RewardedVideoAd.load() to manually re-fetch the ad.
rewardedVideoAd.show()
.catch(err => {
rewardedVideoAd.load()
.then(() => rewardedVideoAd.show())
})
If the automatic fetch is successful, calling the load() method will return a resolved Promise without fetching the ad again.
rewardedVideoAd.load()
.then(() => rewardedVideoAd.show())

Listening for ad closure

The rewarded video ad component can only be closed when the user taps the close button. This event can be listened using RewardedVideoAd.onClose() .
The close button is displayed after the rewarded video finishes playing.So when onClose is triggered, it can be assumed that the user has watched the entire ad.
The callback function for RewardedVideoAd.onClose() will pass a parameter res, where res.isEnded describes the state when the ad ends.
Property
Type
Description
isEnded
boolean
Indicates whether the video was closed after the user watched it completely (true), or during playback (false).





Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 available.

7x24 Phone Support
Hong Kong, China
+852 800 906 020 (Toll Free)
United States
+1 844 606 0804 (Toll Free)
United Kingdom
+44 808 196 4551 (Toll Free)
Canada
+1 888 605 7930 (Toll Free)
Australia
+61 1300 986 386 (Toll Free)
EdgeOne hotline
+852 300 80699
More local hotlines coming soon