简体   繁体   English

如何静音 Google IMA 广告的音量

[英]How to mute volume of Google IMA Ads

I am using Google-IMA Android SDK for loading adds and playing videos in my application.我正在使用Google-IMA Android SDK在我的应用程序中加载添加和播放视频。

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.根据 Android API 参考尝试使用setAdWillPlayMuted(boolean) ,但仍然添加了音频播放。

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.但是在IMA SDK for IOSIMAAdsManager volume API 可用于静音 add 的音量,这在 IOS 设备中按预期工作。

I am using interactivemedia:3.9.0 as per the downloaded sample version in Android.我正在使用interactivemedia:3.9.0根据下载的Android 示例版本。

Do I need to use any other API's or Classes to achieve muting Advertisement volume?我是否需要使用任何其他 API 或类来实现静音广告音量?

NOTE: Muting the system volume is not something I am trying to achieve注意:静音系统音量不是我想要实现的

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.我能够在 Android 上切换 IMA 广告音量的唯一方法是使用 ExoPlayer 加载 IMA 广告。

The ExoPlayer library has APIs that allow for providing an Ad Tag via the AdsMediaSource class. ExoPlayer 库具有允许通过 AdsMediaSource 类提供广告标签的 API。

After successfully loading ads via ExoPlayer, I was able to use the ExoPlayer's volume control APIs to mute/unmute the advertisement.通过 ExoPlayer 成功加载广告后,我能够使用 ExoPlayer 的音量控制 API 将广告静音/取消静音。

Granted it's not the most ideal solution and I'm sorry I don't have better advice.当然,这不是最理想的解决方案,很抱歉我没有更好的建议。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM