0

我已经集成了 Revmob Unity 插件,它运行良好,几乎可以播放 8 到 10 个全屏视频。之后,它不会下载静态或视频插页式广告,它会显示“您的 RAM 已满,无法下载任何内容”。我尝试为静态和视频调用 Release(),但似乎没有任何效果。

当我反复缓存和播放 8 到 10 个视频时,它运行良好。之后它就完全停止了。我等了将近 1 到 2 个小时,期待它恢复,但是:(

这是统一 revob 插件中的问题吗????

拉斐尔,我每次都能重现。我已经在 3 台设备上试过了。在使用 1GB RAM 的 Samsung Mega 5.8 中观看 8 个视频后,我可以重现此问题。

在配备 4GB RAM 的 ASUS zenphone 中,您可以看到在播放 20-30 个视频后 RAM 使用量增加。

顺便说一句,由于我对其他广告网络集成有疑问,我删除了所有广告网络并单独测试了这个以重现此问题。

我有几个问题:RevmobFullScreen 类中 Release() 方法的用途是什么。我找不到你们在示例文件中使用它。太奇怪了,在 clickonad 和 closead 函数之后使用 Release() 允许我播放 5 到 6 个视频,而没有 Release() 调用,我可以播放 8 到 10 个视频。我没有看到使用 Release() 释放任何内存。调用此方法是可选的还是有任何副作用?

另外,关闭或点击广告后重复缓存视频是否会导致内存泄漏??????因为,这是我唯一对 Revmob 做的事情

供您参考,我附上我的代码。

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;
    }
}
4

1 回答 1

0

我无法在我这边重现这种行为,这是我们收到的第一个投诉,所以它似乎不是Revmob插件问题。

无论如何,我们即将发布 9.2.0 版本,其中包括性能改进等。

如果它不能解决您的问题或遇到其他问题,您也可以使用我们的论坛或发送电子邮件至 publisher.support@revmob.com 给我们发送电子邮件。

此致,

于 2016-07-21T14:46:43.053 回答