Set Ad's volume

610 views
Skip to first unread message

Chang Alex

unread,
Jul 13, 2017, 7:52:35 PM7/13/17
to Interactive Media Ads SDK
Hi, 

I want to set Ad's volume. After checking this website, I think I can use IMAVideoDisplay. However, I cannot find any example from this website to know how to get IMAVideoDisplay object. Could you show me an example? By the way, I also check AdvancedExample but unable to find it either.

Thanks
Alex

Joshua Lagonera (IMA SDK Team)

unread,
Jul 13, 2017, 10:58:11 PM7/13/17
to Interactive Media Ads SDK
Hi Alex,

I would be glad to assist you on this. 

You shouldn't need an IMAVideoDisplay object in order to set the volume of the Ads. Once you obtain the Ads Manager from a successful Ad Request, you can set the volume of the IMAAdsManager to change the volume of the ad. Do note that the volume you set is relative to the device's volume. Below is a small sample code snippet to show how this can be achieved:

- (void)adsLoader:(IMAAdsLoader *)loader adsLoadedWithData:(IMAAdsLoadedData *)adsLoadedData {
 
// Grab the instance of the IMAAdsManager and set the delegate.
 
self
.adsManager = adsLoadedData.adsManager;
 
self.adsManager.delegate = self;

 
// Set the current ads' volume to 50% of the device's volume
 
self.adsManager.volume = 0.5f;
 
 
// Create ads rendering settings to tell the SDK to use the in-app browser.
 
IMAAdsRenderingSettings *adsRenderingSettings = [[IMAAdsRenderingSettings alloc] init];
  adsRenderingSettings
.webOpenerPresentingController = self;

 
// Initialize the ads manager.
 
[self.adsManager initializeWithAdsRenderingSettings:adsRenderingSettings];
}

Let me know if this works for you.

Regards,
Joshua Lagonera
IMA SDK Team

Chang Alex

unread,
Jul 18, 2017, 6:23:12 PM7/18/17
to Interactive Media Ads SDK
Hi, Joshua

Thanks for the suggestion. However, there are two issues.

1. If I set the volume during ad instead of adsLoader, it does not work. For example, if I set the volume when user's mute button is clicked during an ad, volume does not change.

2. Then I follow edyour suggestion to set it in loader, it crashes.
My codes:
<code>
- (void)adsLoader:(IMAAdsLoader *)loader adsLoadedWithData:(IMAAdsLoadedData *)adsLoadedData {

    // Grab the instance of the IMAAdsManager and set ourselves as the delegate.
    self.mAdsManager = adsLoadedData.adsManager;
    self.mMgrDelegate = [[adsMgrIMAAdsManagerDelegate alloc] initWithObjs:self.mListener contentPlayer:(AdsMgrImpl*)self.mContentPlayer];
    self.mAdsManager.delegate = self.mMgrDelegate;

    self.mAdsManager.volume = 0.5f;

    // Create ads rendering settings to tell the SDK to use the in-app browser.
    IMAAdsRenderingSettings *adsrs = [[IMAAdsRenderingSettings alloc] init];
    adsrs.webOpenerPresentingController = self.mUivController;
.....
</code>
 
Crash message:
[IMAAdsManager setVolume:]: unrecognized selector sent to instance 0x17028dd40
2017-07-18 15:14:05.877281-0700 SamplePlayer[265:9507] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[IMAAdsManager setVolume:]: unrecognized selector sent to instance 0x17028dd40'

Does this api really work?

Thanks
Alex

Joshua Lagonera (IMA SDK Team)

unread,
Jul 18, 2017, 11:17:14 PM7/18/17
to Interactive Media Ads SDK
Hi Alex,

Interesting. May I ask what version of the IMA iOS SDK you are using? One reason why I'm asking you this is because setting the volume was introduced in version 3.4.1 of the IMA SDK for iOS. Here are the release notes for the iOS IMA SDK for additional reference. 

That said, I modified our Basic Example project to illustrate the solution I provided you on my previous response. Can you try it on your end and check if you can still replicate the issue? Can you also provide us a sample project where you can replicate the issue for us to assist you further?

Regards,
Joshua Lagonera
IMA SDK Team

Joshua Lagonera (IMA SDK Team)

unread,
Jul 27, 2017, 3:25:00 AM7/27/17
to Interactive Media Ads SDK
Hi Alex,

Are you still seeing the issue reported before? Kindly tell us if you would like assistance and provide us the aforementioned information for us to better help you.

Regards,
Joshua Lagonera
IMA SDK Team

Minh Tran

unread,
May 22, 2024, 6:32:00 AMMay 22
to Interactive Media Ads SDK
Dear all, 

The setting as below : 
  self.adsManager.volume = 0.5f;

It can be affected by the volume / decibel original of the TVC / Media File ? 

I mean in case of having 2 tvc with 2 seperated decibel 
1. 80 Decibel
2. 60 decibel

incase of using   self.adsManager.volume = 0.5f in ima sdk , the client will get the same volume , or the 0.5f of 80 decibel that is higher than the 0.5f of the 60 decibels   ? 

Anybody help me ?

Thanks
Minh
Vào lúc 09:58:11 UTC+7 ngày Thứ Sáu, 14 tháng 7, 2017, Joshua Lagonera (IMA SDK Team) đã viết:

IMA SDK

unread,
May 22, 2024, 12:14:01 PMMay 22
to tnhmi...@gmail.com, ima...@googlegroups.com
Hi Minh,

This volume is relative to device volume, not absolute. Default value is 1.

The original volume/decibel of the TVC (video ad) will indeed affect the perceived loudness for the user even when using self.adsManager.volume = 0.5f in the IMA SDK on iOS. The self.adsManager.volume = 0.5f line sets a volume factor of 0.5. This factor is applied to a linear version of the decibel value.

    •    TVC1 has 80 decibels (higher volume)
    •    TVC2 has 60 decibels (lower volume)
    •    Both use self.adsManager.volume = 0.5f

Even though both TVCs have the same volume factor (0.5), TVC1 will be noticeably louder because its starting linear volume (after decibel conversion) is much higher.
Unfortunately, the IMA SDK for iOS doesn't provide a way to directly control the ad volume. However, potential volume variations between ads since some may be louder than others is expected behavior.
 
This message is in relation to case "ref:!00D1U01174p.!5004Q02tJ3X3:ref" (ADR-00236009)

Thanks,
 
Google Logo IMA SDK Team


Reply all
Reply to author
Forward
0 new messages