Mustafa Dwaikat
Mustafa Dwaikat

Reputation: 3692

How to start IMA HTML5 SDK ads muted?

What I'm trying to do is to make the autoplay video on ios 10 using HTML5 and I did that using:

<video autoplay loop muted playsinline controls>
    <source src="http://distribution.bbb3d.renderfarming.net/video/mp4/bbb_sunflower_1080p_30fps_normal.mp4">
</video>

But when using IMA SDK for HTML5 the ad start unmuted and therefore the autoplay will not work.

Is there a way to mute the ads on start (initialize the ads muted)?

Upvotes: 3

Views: 2286

Answers (1)

mborecki
mborecki

Reputation: 162

You have to mute AdsManager it after google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED event.

loader = new google.ima.AdsLoader(...);
loader.addEventListener(
    google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,
    (event) => {
       event.getAdsManager(videoTag).setVolume(0);
    }

Upvotes: 2

Related Questions