5

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

Sreehari
  • 5,621
  • 2
  • 25
  • 59

1 Answers1

2

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.

dell116
  • 5,835
  • 9
  • 52
  • 70
  • 1
    Agreed! Even I got a confirmation from google team that they are not providing explicit controlling of volume in IMA. As system generally controls volume with physical button. Thanks for your suggestion. – Sreehari Nov 10 '18 at 06:48
  • +1 @ "muting the system volume is not something I'm trying to achieve". I was working on a project with another developer and the solution he committed to our app's repo was the "mute the system volume" hack. That pull request was obviously, rejected with extreme prejudice. – dell116 Nov 14 '18 at 22:13
  • @dell116 any chance you could elaborate a bit more on exactly how you used the AdsMediaSource class to load an ad to ExoPlayer? – producerism Jan 17 '20 at 23:37
  • @producerism It's been about a year since I've toyed with that, but have you tried looking at some tutorials or docs? I'm pretty sure the ExoPlayer sample shows how to do this. Also, a quick Google search yielded this tutorial which I remember referencing -> https://medium.com/google-exoplayer/playing-ads-with-exoplayer-and-ima-868dfd767ea – dell116 Jan 19 '20 at 17:07
  • @dell116 I did, thanks. and following the tutorial still wasn't as much help because the extension no longer works after version 3.11.3 https://github.com/google/ExoPlayer/issues/6429 I am using the extension with an older version of IMA SDK in the meantime – producerism Jan 21 '20 at 14:15