5

Code:

void _ads() async {
  var interAd = InterstitialAd(
    adUnitId: "use_some_genuine_ad_id_not_test_one",
  );

  await interAd.load();
  await interAd.show();
}

Problem:

Sometimes Admob loads an Interstitial ad with with video and the volume by default to that ad is set to maximum, is there any way to mute it?

And also for Rewarded video ads, I can't find any option to mute the ads, can anyone help?

iDecode
  • 22,623
  • 19
  • 99
  • 186
  • There is an open issue for this use case and it maybe supported in the future. You can track that [here](https://github.com/FirebaseExtended/flutterfire/issues/2673). But if you really need this you might have to go via method channel based implementation for both android and ios platforms. You can see how such a plugin is written takin [this](https://github.com/luanpotter/audioplayers/tree/master/android/src/main/java/xyz/luan/audioplayerspackage) as an example. – Abhilash Chandran Nov 13 '20 at 13:51
  • Also this [PR](https://github.com/FirebaseExtended/flutterfire/pull/2763/files) can be referenced for your own implementation. – Abhilash Chandran Nov 13 '20 at 13:57

3 Answers3

6

It cannot be muted completely, but reduced to 0.5% It has to be done manually on Android and iOS by changing global settings MobileAds.setAppVolume(0.5);

For Android- https://developers.google.com/admob/android/global-settings

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_my);
    
    MobileAds.initialize(this, new OnInitializationCompleteListener() {
        @Override
        public void onInitializationComplete(InitializationStatus initializationStatus) {}
    });
    
    // 0.5 is the least you can reduce
    MobileAds.setAppVolume(0.5);
    ...
}
2

Since google_mobile_ads 0.13.4, you can use the follow code to mute all ads.

MobileAds.instance.setAppMuted(true);
JT501
  • 1,407
  • 15
  • 12
0

This is for iOS https://developers.google.com/admob/ios/global-settings

func viewDidLoad() {
  super.viewDidLoad()
  // Set app volume to be half of the current device volume.
  GADMobileAds.sharedInstance().applicationVolume = 0.5
  ...
}

The device volume, controlled through volume buttons or OS-level volume slider, determines the volume for device audio output. However, apps can independently adjust volume levels relative to the device volume to tailor the audio experience. You can report the relative app volume to the Google Mobile Ads SDK by setting the applicationVolume property. Valid ad volume values range from 0.0 (silent) to 1.0 (current device volume). Here's an example of how to report the relative app volume to the SDK:

app4g
  • 670
  • 4
  • 24