我已经集成了Revmob Unity插件,并且可以运行几乎8到10个全屏视频。在此之后,它不会下载静态或视频插页式广告,它会说“你的内存已满,无法下载任何内容"”。 我试过为静态和视频调用Release(),但似乎没有任何工作。
当我反复缓存并播放8到10个视频时,它运行良好。之后,它完全停止了。我等了差不多1到2个小时才能恢复,但是:(
这是Unity revmob插件中的一个问题????
拉斐尔,我每次都能重现这一点。我在3台设备上尝试了这个。我可以在使用1GB内存的三星Mega 5.8中观看8个视频后重现此问题。在配备4GB内存的华硕zenphone中,播放20-30个视频后,可以看到内存使用量增加。
BTW,由于我对其他广告网络集成存在疑问,因此我删除了所有广告网络并单独测试了这一广告,以重现此问题。我几乎没有问题: 在RevmobFullScreen类中使用Release()方法的原因是什么。我找不到你们在你的示例文件中使用它。 这很奇怪,在clickonad和closead函数之后使用Release()允许我播放5到6个视频并且没有Release()调用,我可以播放8到10个视频。 我没有看到使用Release()释放任何内存。调用此方法是可选的还是有任何副作用?
此外,关闭或点击广告后重复缓存视频会导致内存泄漏????? cos,这是我用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;
}
}
答案 0 :(得分:0)
我无法重现此行为,这是我们收到的第一个投诉,因此它似乎似乎是Revmob插件问题。
无论如何,我们即将发布版本9.2.0,其中包括性能改进等。
如果它没有解决您的问题或遇到其他问题,您也可以使用our forum或发送电子邮件至publisher.support@revmob.com。
致以最诚挚的问候,