tencent cloud

All product documents
Tencent Cloud Super App as a Service
Last updated: 2025-04-09 18:35:50
Ad
Last updated: 2025-04-09 18:35:50

wx.createRewardedVideoAd

wx.createRewardedVideoAd(Object object)

Feature description:Creates a rewarded video ad component. The rewarded video ad created by this method is a singleton within a page and cannot be used across pages in the mini program.
Parameter: Object object.
Property
Type
Default value
‍Required
Description
adUnitId
string
-
True
Ad unit ID.
multiton
boolean
-
False
Whether to enable multiple-instance mode. Default: false.
Return value:RewardedVideoAd.Rewarded video ad component.

RewardedVideoAd

The rewarded video ad will be rendered as a native component with a higher level than regular components. The rewarded video ad object is a singleton within a page. By default, the rewarded ad is hidden and needs to be displayed using RewardedVideoAd.show().

RewardedVideoAd.load()

Feature description:Loads the rewarded video ad.
Return value:Promise, the result of loading the rewarded video ad data.

RewardedVideoAd.show()

Feature description:Displays a rewarded video ad.
Return value:Promise, the result of displaying the rewarded video ad.

RewardedVideoAd.destroy()

Feature description:Destroys a rewarded video ad instance.

RewardedVideoAd.onLoad(function listener)

Feature description:Listens for the rewarded video ad loading event.
Parameter: function listener. The listener for the rewarded video ad loading event.

RewardedVideoAd.offLoad(function listener)

Feature description:Removes the listener for the rewarded video ad loading event.
Parameter: function listener. The listener that was passed to onLoad. If not provided, all listeners will be removed.
Example:
const listener = function (res) { console.log(res) }

RewardedVideoAd.onLoad(listener)
RewardedVideoAd.offLoad(listener) // Must pass the same function object used in onLoad

RewardedVideoAd.onError(function listener)

Feature description:Listens for rewarded video error events.
Parameter: function listener. The listener for rewarded video error events.
Return parameter: Object res.
Property
Type
Description
errMsg
string
Error information.
errCode
number
Error code.

RewardedVideoAd.offError(function listener)

Feature description:Removes the listener for rewarded video error events.
Parameter: function listener. The listener that was passed to onError. If not provided, all listeners will be removed.
Example:
const listener = function (res) { console.log(res) }

RewardedVideoAd.onError(listener)
RewardedVideoAd.offError(listener) // Must pass the same function object used in onError

RewardedVideoAd.onClose(function listener)

Feature description:Listens for the event when a user taps the close button.
Parameter: function listener. The listener for the event when a user taps the close button.
Return parameter: Object res.
Property
Type
Description
isEnded
boolean
Whether the video was closed after the user watched it completely.

RewardedVideoAd.offClose(function listener)

Feature description:Removes the listener for the event when a user taps the close button.
Parameter: function listener. The listener that was passed to onClose. If not provided, all listeners will be removed.
Example:
const listener = function (res) { console.log(res) }

RewardedVideoAd.onClose(listener)
RewardedVideoAd.offClose(listener) // Must pass the same function object used in onClose

Error code

Error codes are obtained through onError event. During debugging, you can capture error details via exception returns. You can add appropriate monitoring information to assist in troubleshooting issues in the live environment.
Error code
Description
Reason
1000
Failed to call the backend API
This error is not caused by the developer.
1001
Parameter error
Incorrect usage.
1002
Invalid ad unit
Incorrect ad unit ID spelling or accidental use of another app's ad unit ID.
1003
Internal error
This error is not caused by the developer.
1004
No suitable ad
Ads do not appear every time; this time it might not appear because there are no ads that match the user's preferences.
1010
Ad feature disabled
The ad feature has been disabled.

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