AdService
A service for displaying mobile video ads as a form of monetization. Use it to implement rewarded video ads in your experience.
Summary
Methods
Creates a reward to give users who watch an entire video ad.
Show mobile video advertisements.
Checks if a video ad is available to be played to the current user inside the experience.
Plays the video ad to the current user inside the experience.
Events
Fires when an AdService video closes.
Properties
Methods
CreateAdRewardFromDevProductId
Creates a reward to give users who watch an entire video ad.
Parameters
The ID of the developer product you want to grant as a reward.
Returns
ShowVideoAd
Show mobile video advertisements.
Returns
GetAdAvailabilityNowAsync
Checks if a video ad is available to be played to the current user inside the experience.
Parameters
The format of the requested ad. For example, RewardedOnDemandVideo.
Returns
Code Samples
local adAvailabilityResult = AdService:GetAdAvailabilityNow(Enum.AdAdFormat.RewardedOnDemandVideo)
ShowRewardedVideoAdAsync
Plays the video ad to the current user inside the experience.
Parameters
The Player object for whom you are fetching the ad for.
The reward object for the reward you want to grant the user who watches an ad to completion.
The ID of the placement of the rewarded video ad inside the experience. Allows for reporting on the performance of individual ad placements.
Returns
Code Samples
local reward = AdService:CreateAdRewardFromDevProductId(100)
local result = AdService:ShowRewardedVideoAdAsync(player, reward)