How to implement AppLovin Reward Video in unity? - unity3d

I'm trying to add reward video from AppLovin to my application. Interstitial is work perfectly. But Reward video return "LOADREWARDEDFAILED".
Here is the part where I initialize
AppLovin.SetSdkKey(SDKKey);
AppLovin.InitializeSdk();
AppLovin.PreloadInterstitial();
AppLovin.LoadRewardedInterstitial();
AppLovin.SetUnityAdListener("ApplovinListener");
// AppLovin.SetTestAdsEnabled("true");
Here is the part where should be show
if (AppLovin.IsIncentInterstitialReady())
AppLovin.ShowRewardedInterstitial();
else
AppLovin.LoadRewardedInterstitial();
Message from xcode:
LOADREWARDEDFAILED
ApplovinListener:onAppLovinEventReceived(String)

Related

Manage Game Music At Fullscreen Ad Display Time

I have used AppLovin Ad Network to display fullscreen ads within the game.
So I want to turn off game music when fullscreen ad displayed and again turn on game music when fullscreen ad closed by the game player.
I have followed this guideline:
Unity3d Integration
Here we have different listeners available:
Ad Listeners in Unity
I was getting the problem in iOS only in Android automatically game background music gets paused and played again when I closed the fullscreen ad.
Code that I have tested up to now:
public void ShowAppLovinInsterstitial()
{
// Showing utilizing PreloadInterstitial and HasPreloadedInterstitial
if (AppLovin.HasPreloadedInterstitial())
{
// An ad is currently available, so show the interstitial.
AppLovin.ShowInterstitial();
#if UNITY_IOS
SoundManager.Instance.EnableGameMusic(false);
#endif
}
else
{
// No ad is available. Perform failover logic...
AppLovin.PreloadInterstitial();
}
}
void onAppLovinEventReceived(string ev)
{
if (ev.Contains("HIDDENINTER"))
{
// Ad ad was closed. Resume the game.
// If you're using PreloadInterstitial/HasPreloadedInterstitial, make a preload call here.
#if UNITY_IOS
SoundManager.Instance.EnableGameMusic(true);
#endif
AppLovin.PreloadInterstitial();
}
else if (ev.Contains("CLOSEDFULLSCREEN"))
{
#if UNITY_IOS
SoundManager.Instance.EnableGameMusic(true);
#endif
}
}
At present, game music gets paused after fullscreen ad displayed. On fullscreen ad, it was not again started.
Please give me some suggestion for the gameplay music turn on and off during fullscreen ads display.

Unity WebGL build Webcam texture not working

I have basic webgl app with Unity3D 2017 where im using webcam texture to display webcam feed on the screen. Here is the code im using to request webcam permission:
yield return Application.RequestUserAuthorization(UserAuthorization.WebCam);
if (Application.HasUserAuthorization(UserAuthorization.WebCam))
{
Debug.Log("webcam found");
startWebCam ();
}
else
{
Debug.Log("webcam not found");
}
And here is the code to render webcam feed on a plane that users see.
void startWebCam() {
WebCamDevice device = WebCamTexture.devices[0];
cam_texture = new WebCamTexture (device.name);
camera_renderer.material.mainTexture = cam_texture;
cam_texture.Play ();
}
It works fine in editor but does not work when i export a webgl build. It does ask for permission to use webcam and then the green light beside my laptop camera turns on but all i can see is black screen. However, the was one time when I think i refreshed twice or something, the webcam feed appeared. I have not been able to reproduce it after that.
Would appreciate any help here. Thanks.
Got the issue resolved. The problem was that autoplay is forbidden on Webgl apps (at least on chrome). So all i had to do is ask user to tap on screen before starting webcam. Fixed.

RevMobAds - Test video ads not loading?

Ive opted towards RevMob since the iAd network isn't accepting new apps and I'm trying to put a video ad after a round of my game is played like this:
func gameOver() {
RevMobAds.session().fullscreen().loadVideo()
RevMobAds.session().fullscreen().showVideo()
let transition = SKTransition.fadeWithDuration(0.5)
let gameScene = GameOver(size: self.size)
self.view!.presentScene(gameScene, transition: transition)
}
My fullscreen and banner ads are working perfectly, but when I end the game to load the video, I get this in the console with no ad being shown:
[RevMob] Ad received: (200) - 56ba71998e700003764c65b9
Is anyone else having this problem? If so, have you fixed it?
We have changed our documentation, please checkout the updated one here.
What I believe is happening is that you are not saving the fullscreen object. You should create a fullscreen object and save it into a variable:
video = RevMobAds.session().fullscreen()
Then you can load a video ad into the fullscreen object: video!.loadVideo()
And then showVideo on the fullscreen object: video!.showVideo()
Note that loadVideo() is an asynchronous call, so you should either call the methods with completion handlers or extend our delegate classes.
Best regards,

MPMoviePlayerController - Exit, detect movie play and iAd

I have successfully integrated a working movie player with a pre-roll iAd video! Thanks to #Daniel Storm. However, I want information on how to exit the movie when the movie is finished or when the ad is finished. (exit means remove from the view), Also detect if the user has watched the ad. If there is internet connection failure or iAd failure, how can i detect if the pre-roll ad did not play.
I am making a game, and if a user decides to get more coins, that person must watch an ad. If they click on the watch ad button, I want to detect if the ad loaded successfully so that person can get coins after they watch the ad. Once the ad finishes I want to dismiss the MPMoviePlayerController view.
Thank you for your help!
Edit:
Is this correct? :
Is it ok to remove the MPMoviePlayerViewController from the view after it is played like this?: Is this the correct way to remove it?
moviePlayer.playPrerollAdWithCompletionHandler { (error) -> Void in
NSLog("\(error)")
self.moviePlayer.view.removeFromSuperview()
I am supposing this is correct because it removes the view, but is this what apple intends us to do?

How to stop video player on samsung Smart TV App without to show the black screen

Hi I'm developing Samsung app with SDK and emulator 4.5. I have a issue..The App shows by videoPlayer some videos loaded on server. My issue is: when the video play and I push button STOP, the video stops and the screen becomes black..I'd like to show the screen with the first frame of the video.
I have tried to do:
sf.service.VideoPlayer.setKeyHandler(tvKey.KEY_STOP, function()
{
if(Popup.getPopup()==Popup.getNPOPUP() && Similars.getOpenS()==false){
//videoPlayer.enterVideo(videoPlayer.url,videoPlayer.title,videoPlayer.from,videoPlayer.axoid,videoPlayer.nid); //riparte l'esecuzione del video
sf.service.VideoPlayer.stop();
videoPlayer.play();//insert function play
sf.service.VideoPlayer.pause();// stop video
videoPlayer.setFullScreen();
sf.service.VideoPlayer.show();
sf.service.VideoPlayer.pause();//stefa
}
});
I have inserted:
videoPlayer.play();//insert function play
sf.service.VideoPlayer.pause();// stop video
The play works but the pausa command not work
How can I do? Have you got a solution?
Thanks
I have inserted below
sf.service.VideoPlayer.stop();
setTimeout(function(){sf.service.VideoPlayer.pause();},2000); //delay function called of 2000 millisecond
I resolved my issue.
if delay time is not enough, you can increase the time to get the finish request.