correct use of vungle in storyboard

hello to all. 
 
I’m trying to use vungle storyboard. 
 
my code like this:
 

Scene X
 

methods before the storyboard   


local provider = “vungle” ;
 
local appID = “XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX” 
 
local ads = require “ads”;
 
local  function isAdAvailable(event)
 
end
 
ads.init( provider, appID, isAdAvailable );
 
ads:setCurrentProvider(“vungle”);


in button_next_touch

function button_next:touch(e)

if(e.phase == “ended” or e.phase == “cancelled”) then

                        if (ads.isAdAvailable ) then

                            ads.show( “interstitial”, { isBackButtonEnabled = true } );

                        end                

storyboard.gotoScene(“Scene X+1”, fade, 200);

end;

end;

Errors:

in Scene X --> the video runs 2 times.

in Scene X+1 --> also runs the video. 

in Scene X+1 --> the reload is also implemented.

Please help me.

Mine works fine in Storyboard, don’t have as much stuff involved a you

main.lua

ads = require “ads”

ads.init( “vungle”, ‘xxxxxxxxxx’ )

Later when calling ad in different scene:

ads.show()

You seem to be calling your ad in the middle of a screen transition, perhaps that is causing error.

Mine works fine in Storyboard, don’t have as much stuff involved a you

main.lua

ads = require “ads”

ads.init( “vungle”, ‘xxxxxxxxxx’ )

Later when calling ad in different scene:

ads.show()

You seem to be calling your ad in the middle of a screen transition, perhaps that is causing error.