How to do Appodeal rewarded videos?

I already explained it above but a little more clarification:

I have revive button,

when the user clicks on the button a reward video shows up,

when the video ends, the player will be taken back to the game scene where they play again.

I have got all that to work except for the part when the video ends and the player is taken back to the game.

This is all I have:

local appodeal = require( "plugin.appodeal" ) local function adListener( event )     if ( event.phase == "init" ) then  -- Successful initialization         print( event.isError )     end if ( event.phase == "closed" ) then  -- Successful initialization         print( event.isError ) composer.gotoScene("game")     end end -- Initialize the Appodeal plugin appodeal.init( adListener, { appKey="" } ) if ( appodeal.isLoaded( "rewardedVideo" ) ) then     appodeal.show( "rewardedVideo",{placement="intPlacement"} ) end

Any ideas?

Okay maybe I should rephrase my question:

How can I make the scene change when a rewarded video ends?

Are you posting your actual code? Or are you copying parts and posting them so it looks like one block of code?

Where are you preloading the ad?

Where are you printing out the content of the event table that your adListener is receiving? You should be dumping this table so you can look at your device’s console log to see what’s going on.

Are you testing on a device?

Are you getting a rewarded video?

Rob

Ok well figured it out myself.

Sometimes when the video ends it doesn’t give the reward.

Thats why i display a message telling the user to "click here to revive) just before the ad shows up .

Most of it is actual code except for the if statement after init().

I saw other recent posts and found out how they did the reward video thing.

@rob if i am not mistaken the appodeal plugin documentation states that calling appodeal.load is not necessary and it caches ads by default on init , please correct me if i am wrong.
 
@Joe i think the best phase to reward your player is on “playbackEnded” and not on “closed” , 

i am checking : 

if event.phase == "playbackEnded" and event.type=="rewardedVideo" then  

I tried that but it didnt work…

Joe,

Add code to your listener to print out ALL of the details of the event, then run some tests till you understand what events happen when and what fields get set based on the actions you take.

Once you understand this, it will be straightforward.

Even better, do what I do when I investigate a new ad plugin.

Make a test bench with buttons and visual feedback right on the screen that allow you to load, show, etc.

Then you can easily test out how things work and see what happens.

I don’t know if you have any interest in this, but I expect to have a framework ready by early to mid next week to simplify using Appodeal and Applovin even more.

They are both pretty easy to use, but my framework will make it drop-dead-simple to get this stuff working and give you the added bonus of being able to test your ad logic in the simulator.

If this discussion is still active when I release it, I’ll cross post here.

Oh yes please do!

Here is that post I promised to cross link: 

https://forums.coronalabs.com/topic/73312-starters-core/