0

I have integrated Revmob Unity Plugin and its running fine for almost 8 to 10 fullscreen video. After that, its not downloading static or video interstitials, it says "Your RAM is full and can't download anything". I've tried calling Release() for both static and video, but nothing seems to be working.

When I cache and play 8 to 10 videos repeatedly, its running fine. After that it's stopped completely. I waited for almost 1 to 2 hours expecting it to regain, but :(

Is this an issue in unity revmob plugin ????

Raphael, I can reproduce this every single time. I have tried this in 3 devices. I can reproduce this issue after watching 8 videos in Samsung Mega 5.8 with 1GB RAM.

In ASUS zenphone with 4GB RAM, you can see RAM usage increasing after playing 20-30 videos.

BTW, since I had doubt with other ad network integration, I removed all ad networks and tested this one alone to reproduce this issue.

I have few questions: What's the use of Release() method in RevmobFullScreen class. I can't find you guys using it in your example files. It's so weird, using Release() after clickonad and closead functions allowing me to play 5 to 6 videos and Without Release() call, I can play 8 to 10 videos. I don't see any memory getting released by using Release(). Is calling this method optional or does it have any side effects?

Also, does caching video repeatedly after closing or clicking an ad cause memory leaks ????? cos, this is the only thing I am doing with Revmob nothing else

For your reference, I am attaching my code.

using UnityEngine;
using System.Collections;
using System;
using System.Collections.Generic;

public class RevmobController : BaseController, IRevMobListener {

    private Dictionary<string, string> REVMOB_APP_IDS;

    private static RevMob revmob;
    private static RevMobBanner banner;
    private static RevMobFullscreen fullscreenStatic;
    private static RevMobFullscreen fullscreenVideo;

    public bool bannerAdsOnBootup;
    public bool interstitialAdsOnBootup;
    private bool fullscreenStaticAvailable;
    private bool fullscreenVideoAvailable;

    public bool createBanner;

    private static RevmobController adsController;

    public string androidMediaId;
    public string iosMediaId;

    private enum TYPE_OF_AD {STATIC, VIDEO};
    private TYPE_OF_AD typeOfAd;
    public static RevmobController SharedInstance() {
        return adsController;
    }


    void Awake() {      
        adsController = this;
        DontDestroyOnLoad( adsController );
        REVMOB_APP_IDS = new Dictionary<string, string>() {
            { "Android", androidMediaId},
            { "IOS", iosMediaId }
        };
        revmob = RevMob.Start (REVMOB_APP_IDS, gameObject.name);
    }

    // Use this for initialization
    void Start () {     

    }

    public bool ShowFullscreenStatic(string location)
    {
        if( !fullscreenStaticAvailable ) {
            return false;
        }
        this.location = location;
        StartCoroutine( LoadInterstitial(location));
        return true;
    }

    IEnumerator LoadInterstitial( string location ) {
        yield return null;
        fullscreenStatic.Show();
    }

    public bool ShowFullscreenVideo(string location)
    {
        if( !fullscreenVideoAvailable ) {
            return false;
        }
        this.location = location;
        StartCoroutine( LoadVideoInterstitial(location));
        return true;
    }

    IEnumerator LoadVideoInterstitial( string location ) {
        yield return null;
        fullscreenVideo.ShowVideo();
    }

    public void CacheStaticInterstitial(string location) {
        if( !AdsService.SharedInstance().IsInternetConnected()) {
            return;
        }
        DestroyStatic();
        StartCoroutine(CacheAfterEndofFrame(location, TYPE_OF_AD.STATIC));
    }
    public void CacheVideoInterstitial() {
        if( !AdsService.SharedInstance().IsInternetConnected()) {
            return;
        }
        DestroyVideo();
        StartCoroutine(CacheAfterEndofFrame(location, TYPE_OF_AD.VIDEO));
    }

    IEnumerator CacheAfterEndofFrame(string location, TYPE_OF_AD typeOfAd) {
        yield return null;
        this.typeOfAd = typeOfAd;
        if( typeOfAd ==  TYPE_OF_AD.STATIC ) {
            fullscreenStatic = revmob.CreateFullscreen(location);
        } else {                        
            fullscreenVideo  = revmob.CreateVideo(location);
        }
    }

    public void SessionIsStarted ()
    {
        Debug.Log("Session started.");
        if( createBanner ) {
            banner= revmob.CreateBanner();
        }

        CacheStaticInterstitial("Bootup");
        CacheVideoInterstitial();

        if( bannerAdsOnBootup && banner != null ) {
            if (PlayerPrefs.GetInt("removeads",0) == 0) {
                banner.Show();
            }
        }
    }       

    public void SessionNotStarted (string revMobAdType)
    {
        Debug.Log("Session not started.");
    }
    public void AdDidReceive (string revMobAdType)
    {
        Debug.Log("Ad did receive.");
        if( typeOfAd == TYPE_OF_AD.STATIC ) {
            fullscreenStaticAvailable = true;
        } else if( typeOfAd == TYPE_OF_AD.VIDEO ) {
            fullscreenVideoAvailable = true;
        }

        if( interstitialAdsOnBootup ) {
            ShowFullscreenStatic("Bootup");
            interstitialAdsOnBootup = false;
            fullscreenStaticAvailable = false;
        }
    }
    public void AdDidFail (string revMobAdType)
    {       
        Debug.Log("Ad did fail.");
    }
    public void AdDisplayed (string revMobAdType)
    {
        Debug.Log("Ad displayed.");
        AdsService.SharedInstance().PauseAudio();
    }
    public void UserClickedInTheAd (string revMobAdType)
    {
        Debug.Log("Ad clicked.");
        if( typeOfAd == TYPE_OF_AD.STATIC ) {
            fullscreenStaticAvailable = false;  
            DestroyStatic();
            //CacheStaticInterstitial();
        } else if( typeOfAd == TYPE_OF_AD.VIDEO ) {
            fullscreenVideoAvailable = false;
            DestroyVideo();
            //CacheVideoInterstitial();
        }
    }
    public void UserClosedTheAd (string revMobAdType)
    {
        Debug.Log("Ad closed.");
        AdsService.SharedInstance().ResumeAudio();
        CallOnAdComplete(this.location);
        if( typeOfAd == TYPE_OF_AD.STATIC ) {
            fullscreenStaticAvailable = false;  
            DestroyStatic();
            //CacheStaticInterstitial();
        } else if( typeOfAd == TYPE_OF_AD.VIDEO ) {
            fullscreenVideoAvailable = false;
            DestroyVideo();
            //CacheVideoInterstitial();
        }
    }

    void DestroyStatic() {
        if( fullscreenStatic != null ) {
            //fullscreenStatic.Hide();
            //fullscreenStatic.Release();
            //fullscreenStatic = null;
        }
    }

    void DestroyVideo() {
        if( fullscreenVideo != null ) {
            //fullscreenVideo.Hide();
            //fullscreenVideo.Release();
            //fullscreenVideo = null;
        }
    }

    public void VideoStarted() {
    }   
    public void VideoFinished() {       
        //fullscreenVideoAvailable = false;
        /*fullscreenVideo.Release();
        fullscreenVideo = revmob.CreateVideo();*/
    }
    public void VideoLoaded() {
        fullscreenVideoAvailable = true;

    }
    public void VideoNotCompletelyLoaded() {
    }
    public void RewardedVideoLoaded() {
    }
    public void RewardedVideoNotCompletelyLoaded() {
    }
    public void RewardedVideoStarted() {
    }
    public void RewardedVideoFinished() {
    }
    public void RewardedVideoCompleted() {
    }
    public void RewardedPreRollDisplayed() {
    }

    void OnDestroy() {
        if( banner != null ) {
            //banner.Release();
        }
        if( fullscreenVideo != null ) {
            //fullscreenVideo.Release();
        }
        if( fullscreenStatic != null ) {
            //fullscreenStatic.Release();
        }
        adsController = null;
    }
}
Kenshin
  • 1,030
  • 2
  • 12
  • 41

1 Answers1

0

I can't reproduce this behavior on my side and this is the first complaint we receive, so it doesn't seem to be a Revmob Plugin issue.

In any case, we're about to release version 9.2.0 which comes with performance improvements among other things.

If it doesn't fix your problem or you run into other issues, you can also use our forum or email us at publisher.support@revmob.com .

Best regards,

Raphael
  • 71
  • 2
  • Raphael, Could you please check my question again?. I edited it and posted my entire code. Could you check and let me know if there is an issue in code ??? – Kenshin Jul 22 '16 at 06:04
  • and when is 9.2.0 getting released?? – Kenshin Jul 22 '16 at 06:04
  • Whats is the use of Release() method? Do I need to call this method to release static or video interstitial memory ???? – Kenshin Jul 27 '16 at 11:31