dreamsoftin / facebook_audience_network

Flutter Facebook Audience Network
https://pub.dartlang.org/packages/facebook_audience_network/
MIT License
156 stars 99 forks source link

Couldn't retrieve video information. Error not catched and app crashed #12

Closed jerinho closed 5 years ago

jerinho commented 5 years ago

This error not catched and throwed to listener. So the screen just freezing until app-not-responding dialog shows up.

Couldn't retrieve video information java.lang.RuntimeException: failure code: -38 at android.media.MediaPlayer.invoke(MediaPlayer.java:710) at android.media.MediaPlayer.getInbandTrackInfo(MediaPlayer.java:2239) at android.media.MediaPlayer.getTrackInfo(MediaPlayer.java:2221) at com.facebook.ads.internal.tv.d(SourceFile:680) at com.facebook.ads.internal.rp.k(SourceFile:431) at com.facebook.ads.internal.np$9.a(SourceFile:162) at com.facebook.ads.internal.np$9.a(SourceFile:156) at com.facebook.ads.internal.he.a(SourceFile:1143) at com.facebook.ads.internal.rp$2.run(SourceFile:191) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:146) at android.app.ActivityThread.main(ActivityThread.java:5602) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099) at dalvik.system.NativeStart.main(Native Method)

My code

FacebookInterstitialAd.destroyInterstitialAd().then((bool success){
    FacebookInterstitialAd.loadInterstitialAd(
        placementId: "MY_PLACEMENT_ID",
        listener: (InterstitialAdResult result, value) {
            if(result == InterstitialAdResult.LOADED) FacebookInterstitialAd.showInterstitialAd(delay: 5000);
            else if(result == InterstitialAdResult.DISMISSED) onDismissed();
            else if(result == InterstitialAdResult.ERROR) onError();
        }
    );
});
SurajShettigar commented 5 years ago

When are you calling FacebookInterstitialAd.destroyInterstitialAd()? This should be called only to dismiss an already shown interstitial ad programmatically, instead of user dismissing the ad.