Closed gogodigimo closed 3 years ago
Kindly try the following code ` function loadFBRewardVideoAd() {
var options={
videoid:facebookAdIds.videoid
,isTesting:_isTesting
};
cordova.plugins.codeplayfacebookads.loadRewardVideoAd(options,function(a){
staticResult(a);
},function(a){ rewardVideoError(); });
}
function staticResult(result)
{
if(result==1)
console.log("Facebook Rewarded video ad impression logged!");
else if(result==2)
console.log("Facebook Rewarded video ad clicked!");
else if(result==3)
{
console.log("Facebook Rewarded video completed!");
videoRewardGiven();
}
else if(result==4)
{
_isFBVideoLoaded=false;
videoIconChanger();
console.log("Facebook Rewarded video ad closed!");
loadFBRewardVideoAd();
}
else if(result==5)
{
_isFBVideoLoaded=true;
videoIconChanger();
console.log("Facebook Rewarded video ad is loaded and ready to be displayed!");
}
else
console.log(result);
}
function videoIconChanger() { if(_isFBVideoLoaded || _isGoogleVideoLoaded) { $("#watchVideoIcon").css("filter","none"); } else { $("#watchVideoIcon").css("filter","grayscale(1)"); } }
function showFBRewardVideoAd() {
var options={
videoid:facebookAdIds.videoid
,isTesting:_isTesting
};
cordova.plugins.codeplayfacebookads.showRewardVideoAd(options,showFBRewardVideoSuccess,rewardVideoError);
}
function showFBRewardVideoSuccess(result) { staticResult(a); }
function rewardVideoError(result) { console.log(result);
_isFBVideoLoaded=false;
videoIconChanger();
setTimeout(function(){
loadFBRewardVideoAd();
},15*1000);
}`
This all works great. Thanks for building it out.
Is there a way to get a callback when a reward video has completed? I can't find any documentation on it.