Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to mute volume of Google IMA Ads

I am using Google-IMA Android SDK for loading adds and playing videos in my application.

From the sample app provided in this link , I am able to play advertisements and videos.

But I am not able to mute audio for advertisements played.

Tried with setAdWillPlayMuted(boolean) as per the Android API reference, but still adds play with audio.

But in IMA SDK for IOS, IMAAdsManager volume API can be used to mute volume for add , which is working in IOS devices as expected.

I am using interactivemedia:3.9.0 as per the downloaded sample version in Android.

Do I need to use any other API's or Classes to achieve muting Advertisement volume?

NOTE: Muting the system volume is not something I am trying to achieve

like image 273
Sreehari Avatar asked Oct 29 '22 05:10

Sreehari


1 Answers

The only way I was able to toggle the volume of an IMA Advertisement on Android was to use ExoPlayer to load the IMA advertisement.

The ExoPlayer library has APIs that allow for providing an Ad Tag via the AdsMediaSource class.

After successfully loading ads via ExoPlayer, I was able to use the ExoPlayer's volume control APIs to mute/unmute the advertisement.

Granted it's not the most ideal solution and I'm sorry I don't have better advice.

like image 125
dell116 Avatar answered Nov 15 '22 06:11

dell116