FBInstant.getRewardedVideoAsync

From GiderosMobile
Revision as of 15:26, 13 July 2023 by Hgy29 (talk | contribs) (Text replacement - "<source" to "<syntaxhighlight")


Available since: Gideros 2018.3
Class: * Initialisation and Core

Description


Attempt to create an instance of rewarded video. This instance can then be preloaded and presented.

<syntaxhighlight lang="lua">

FBInstant.getRewardedVideoAsync(placementID,callback)

</source>

Parameters

placementID: (string) The placement ID that's been setup in your Audience Network settings.
callback: (function) A function that will be called with two arguments: Resolves with a #adinstance, or rejects with a #apierror if it couldn't be created. An error code if the function failed.

Examples

Example
<syntaxhighlight lang="lua"> FBInstant.getRewardedVideoAsync("my_placement_ad", function(result,error) print("getRewardedVideoAsync result:",result) end)
</source> Example 2
<syntaxhighlight lang="lua"> FBInstant.getRewardedVideoAsync("my_placement_ad", function(result,error) advert = result -- make a global of the result advert:loadAsync( function () -- Preload the reward advert. print("Advert loaded!") advert:showAsync( function () -- show the reward advert. print("Reward advert watched!") end) end) end)
</source>