IMA video autoplay policy changes to Chrome: cannot mute sound AdError 901

824 views
Skip to first unread message

Peter Adams

unread,
Apr 24, 2018, 11:01:59 AM4/24/18
to Interactive Media Ads SDK
Hi

We are using a custom player for our IMA video ads.

Do to the recent Chrome policy changes I want to mute desktop ads.

I have added the following line:

adsManager.setVolume(0);

after this line:

adsManager.start();


and I get the following error:

"Ad error: AdError 901: An unexpected error occurred within the VPAID creative. Refer to the inner error for more info. Caused by: Error: AdError 1009 (The VAST response document is empty.)"

If I do not make the call to adsManager.setVolume(0); then a TrueView video is displayed.

I have attached the javascript file.

Any help would be much appreciated.

Thank you.

Regards
Peter

Peter Adams

unread,
Apr 24, 2018, 11:03:59 AM4/24/18
to Interactive Media Ads SDK
A Copy of the code is here, I couldn't attach it as a file.

// Add a hidden id="googleLang" with the possible languages
var googleLanguage = 'en';
if($('#googleLang'))
{
googleLanguage = $('#googleLang').html();
if(googleLanguage === '' || googleLanguage === undefined) googleLanguage = 'en';
}

var adsRequested = false;

// Copyright 2013 Google Inc. All Rights Reserved.
// You may study, modify, and use this example for any purpose.
// Note that this example is provided "as is", WITHOUT WARRANTY
// of any kind either expressed or implied.

/**
 * Handles user interaction and creates the player and ads controllers.
 */
var Application = function() {
  this.adTagBox_ = document.getElementById('tagText');
  this.sampleAdTag_ = document.getElementById('sampleAdTag');
// Match was crashing because this element didn't exist
if(!this.sampleAdTag_)  
{
return;
}
  this.sampleAdTag_.addEventListener(
      'click',
      this.bind_(this, this.onSampleAdTagClick_),
      false);
  this.console_ = document.getElementById('console');
  this.playButton_ = document.getElementById('playpause');
  this.playButton_.addEventListener(
      'click',
      this.bind_(this, this.onClick_),
      false);
  this.fullscreenButton_ = document.getElementById('fullscreen');
  this.fullscreenButton_.addEventListener(
      'click',
      this.bind_(this, this.onFullscreenClick_),
      false);

  this.fullscreenWidth = null;
  this.fullscreenHeight = null;

  var fullScreenEvents = [
      'fullscreenchange',
      'mozfullscreenchange',
      'webkitfullscreenchange'];
  for (key in fullScreenEvents) {
    document.addEventListener(
        fullScreenEvents[key],
        this.bind_(this, this.onFullscreenChange_),
        false);
  }

  this.playing_ = false;
  this.adsActive_ = false;
  this.adsDone_ = false;
  this.fullscreen = false;

  this.videoPlayer_ = new VideoPlayer();
  this.ads_ = new Ads(this, this.videoPlayer_);

  this.videoPlayer_.registerVideoEndedCallback(
      this.bind_(this, this.onContentEnded_));
};

// &slotname=9617174290 = Multiplayer Video Desktop, TrueView & Instream up to 15 seconds

Application.prototype.log = function(message) {
  //console.log(message);
  this.console_.innerHTML = this.console_.innerHTML + '<br/>' + message;
};

Application.prototype.resumeAfterAd = function() {
    $('#videocontainer').hide();
    $('#MatchCommentaryScreen').show();
$('#quickLinks').show();
$('nav .container').show(); // Show top nav content
$('aside div').show(); // Show left menu content
$('aside ul').show(); // Show left menu content
$('aside .sub-menu ul').css('display', 'none'); // Collapse all Left menu items
    $('#leftAd').show();
    $('#footer').show();

// Old UI
$('#liveMatchContent').show();
$('#adslot_1').show();
$('#adslot_1').css('visibility', 'visible');
$('#adslot_top').show();
// Old UI
$('#liveMatchContent').show();
$('#adslot_1').show();
$('#adslot_1').css('visibility', 'visible');
$('#adslot_top').show();
  //this.videoPlayer_.play();
  //this.adsActive_ = false;
  this.updateChrome_();
};

Application.prototype.pauseForAd = function() {
  this.adsActive_ = true;
  this.playing_ = true;
  this.videoPlayer_.pause();
  this.updateChrome_();
};

Application.prototype.adClicked = function() {
  this.updateChrome_();
};

Application.prototype.bind_ = function(thisObj, fn) {
  return function() {
    fn.apply(thisObj, arguments);
  };
};

Application.prototype.onSampleAdTagClick_ = function() {
  this.adTagBox_.value = this.SAMPLE_AD_TAG_;
};

Application.prototype.onClick_ = function() {
  if (!this.adsDone_) {
//    if (this.adTagBox_.value == '') {
//      this.log('Error: please fill in an ad tag');
//      return;
//    } else {
//      this.adTagUrl_ = this.adTagBox_.value;
//    }

    if($('#MatchCommentaryScreen').css('display') == 'block' || $('#liveMatchContent').css('display') == 'block')
    {
        $('#MatchCommentaryScreen').hide();
        $('#leftAd').hide();
        $('#footer').hide();
        // Old UI
        $('#liveMatchContent').hide();
        $('#leftAd').hide();
        $('#adslot_1').hide();
        $('#adslot_top').hide();
    }

    this.adTagUrl_ = this.SAMPLE_AD_TAG_;

// This was breaking the match day if there was no video
if(!this.ads_)
{
return
}
    // The user clicked/tapped - inform the ads controller that this code
    // is being run in a user action thread.
    this.ads_.initialUserAction();
    // At the same time, initialize the content player as well.
    // When content is loaded, we'll issue the ad request to prevent it
    // from interfering with the initialization. See
    // for more information.
    this.videoPlayer_.preloadContent(this.bind_(this, this.loadAds_));
    this.adsDone_ = true;
    return;
  }

  if (this.adsActive_) {
    if (this.playing_) {
      this.ads_.pause();
    } else {
      this.ads_.resume();
    }
  } else {
    if (this.playing_) {
      this.videoPlayer_.pause();
    } else {
      this.videoPlayer_.play();
    }
  }

  this.playing_ = !this.playing_;

  this.updateChrome_();
};

Application.prototype.onFullscreenClick_ = function() {
  if (this.fullscreen) {
    // The video is currently in fullscreen mode
    var cancelFullscreen = document.exitFullscreen ||
        document.exitFullScreen ||
        document.webkitCancelFullScreen ||
        document.mozCancelFullScreen;
    if (cancelFullscreen) {
      cancelFullscreen.call(document);
    } else {
      this.onFullscreenChange_();
    }
  } else {
    // Try to enter fullscreen mode in the browser
    var requestFullscreen = document.documentElement.requestFullscreen ||
        document.documentElement.webkitRequestFullscreen ||
        document.documentElement.mozRequestFullscreen ||
        document.documentElement.requestFullScreen ||
        document.documentElement.webkitRequestFullScreen ||
        document.documentElement.mozRequestFullScreen;
    if (requestFullscreen) {
      this.fullscreenWidth = window.screen.width;
      this.fullscreenHeight = window.screen.height;
      requestFullscreen.call(document.documentElement);
    } else {
      this.fullscreenWidth = window.innerWidth;
      this.fullscreenHeight = window.innerHeight;
      this.onFullscreenChange_();
    }
  }
  requestFullscreen.call(document.documentElement);
};

Application.prototype.updateChrome_ = function() {
  if (this.playing_) {
    this.playButton_.textContent = 'II';
  } else {
    // Unicode play symbol.
    this.playButton_.textContent = String.fromCharCode(9654);
  }
};

Application.prototype.loadAds_ = function() {
  this.ads_.requestAds(this.adTagUrl_);
};

Application.prototype.onFullscreenChange_ = function() {
  if (this.fullscreen) {
    // The user just exited fullscreen
    // Resize the ad container
    this.ads_.resize(
        this.videoPlayer_.width,
        this.videoPlayer_.height);
    // Return the video to its original size and position
    this.videoPlayer_.resize(
        'relative',
        '',
        '',
        this.videoPlayer_.width,
        this.videoPlayer_.height);
    this.fullscreen = false;
  } else {
    // The fullscreen button was just clicked
    // Resize the ad container
    var width = this.fullscreenWidth;
    var height = this.fullscreenHeight;
    this.makeAdsFullscreen_();
    // Make the video take up the entire screen
    this.videoPlayer_.resize('absolute', 0, 0, width, height);
    this.fullscreen = true;
  }
};

Application.prototype.makeAdsFullscreen_ = function() {
  this.ads_.resize(
      this.fullscreenWidth,
      this.fullscreenHeight);
};

Application.prototype.onContentEnded_ = function() {
    $('#videocontainer').hide();
    $('#MatchCommentaryScreen').show();
$('#quickLinks').show();
$('nav .container').show(); // Show top nav content
$('aside div').show(); // Show left menu content
$('aside ul').show(); // Show left menu content
$('aside .sub-menu ul').css('display', 'none'); // Collapse all Left menu items
    //$('#leftAd').show();
    //$('#footer').show();
// Old UI
$('#liveMatchContent').show();
$('#adslot_1').show();
$('#adslot_1').css('visibility', 'visible');
$('#adslot_top').show();

// Old UI
$('#liveMatchContent').show();
$('#adslot_1').show();
$('#adslot_1').css('visibility', 'visible');
$('#adslot_top').show();
  this.ads_.contentEnded();
};

// Copyright 2013 Google Inc. All Rights Reserved.
// You may study, modify, and use this example for any purpose.
// Note that this example is provided "as is", WITHOUT WARRANTY
// of any kind either expressed or implied.

/**
 * Shows how to use the IMA SDK to request and display ads.
 */
var Ads = function(application, videoPlayer) {
  this.application_ = application;
  this.videoPlayer_ = videoPlayer;
  this.contentCompleteCalled_ = false;
  // Call setLocale() to localize language text and downloaded swfs
  // google.ima.settings.setLocale('fr');
  this.adDisplayContainer_ =
      new google.ima.AdDisplayContainer(this.videoPlayer_.adContainer);
  this.adsLoader_ = new google.ima.AdsLoader(this.adDisplayContainer_);
  this.adsManager_ = null;

  this.adsLoader_.addEventListener(
      google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,
      this.onAdsManagerLoaded_,
      false,
      this);
  this.adsLoader_.addEventListener(
      google.ima.AdErrorEvent.Type.AD_ERROR,
      this.onAdError_,
      false,
      this);
};

// On iOS and Android devices, video playback must begin in a user action.
// AdDisplayContainer provides a initialize() API to be called at appropriate
// time.
// This should be called when the user clicks or taps.
Ads.prototype.initialUserAction = function() {
  this.adDisplayContainer_.initialize();
};

Ads.prototype.requestAds = function(adTagUrl) {
  var adsRequest = new google.ima.AdsRequest();
  adsRequest.adTagUrl = adTagUrl;
  adsRequest.linearAdSlotWidth = this.videoPlayer_.width;
  adsRequest.linearAdSlotHeight = this.videoPlayer_.height;
  adsRequest.nonLinearAdSlotWidth = this.videoPlayer_.width;
  adsRequest.nonLinearAdSlotHeight = this.videoPlayer_.height;
  this.adsLoader_.requestAds(adsRequest);
};

Ads.prototype.pause = function() {
  if (this.adsManager_) {
    this.adsManager_.pause();
  }
};

Ads.prototype.resume = function() {
  if (this.adsManager_) {
    this.adsManager_.resume();
  }
};

Ads.prototype.resize = function(width, height) {
  if (this.adsManager_) {
    this.adsManager_.resize(width, height, google.ima.ViewMode.FULLSCREEN);
  }
};

Ads.prototype.contentEnded = function() {
  this.contentCompleteCalled_ = true;
  this.adsLoader_.contentComplete();
};

Ads.prototype.onAdsManagerLoaded_ = function(adsManagerLoadedEvent) {
  this.application_.log('Ads loaded.');
  this.adsManager_ = adsManagerLoadedEvent.getAdsManager(
      this.videoPlayer_.contentPlayer);
  this.processAdsManager_(this.adsManager_);
};

Ads.prototype.processAdsManager_ = function(adsManager) {
  // Attach the pause/resume events.
  adsManager.addEventListener(
      google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,
      this.onContentPauseRequested_,
      false,
      this);
  adsManager.addEventListener(
      google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,
      this.onContentResumeRequested_,
      false,
      this);
  // Handle errors.
  adsManager.addEventListener(
      google.ima.AdErrorEvent.Type.AD_ERROR,
      this.onAdError_,
      false,
      this);
  var events = [google.ima.AdEvent.Type.ALL_ADS_COMPLETED,
                google.ima.AdEvent.Type.CLICK,
                google.ima.AdEvent.Type.COMPLETE,
                google.ima.AdEvent.Type.FIRST_QUARTILE,
                google.ima.AdEvent.Type.LOADED,
                google.ima.AdEvent.Type.MIDPOINT,
                google.ima.AdEvent.Type.PAUSED,
                google.ima.AdEvent.Type.STARTED,
                google.ima.AdEvent.Type.THIRD_QUARTILE];
  for (var index in events) {
    adsManager.addEventListener(
        events[index],
        this.onAdEvent_,
        false,
        this);
  }

  var initWidth, initHeight;
  if (this.application_.fullscreen) {
    initWidth = this.application_.fullscreenWidth;
    initHeight = this.application_.fullscreenHeight;
  } else {
    initWidth = this.videoPlayer_.width;
    initHeight = this.videoPlayer_.height;
  }
  adsManager.init(
    initWidth,
    initHeight,
    google.ima.ViewMode.NORMAL);

  adsManager.start();
  //adsManager.setVolume(0); // Mute sound
};

Ads.prototype.onContentPauseRequested_ = function(adErrorEvent) {
  this.application_.pauseForAd();
};

Ads.prototype.onContentResumeRequested_ = function(adErrorEvent) {
  // Without this check the video starts over from the beginning on a
  // post-roll's CONTENT_RESUME_REQUESTED
  if (!this.contentCompleteCalled_) {
    $('#videocontainer').hide();
    $('#MatchCommentaryScreen').show();
$('#quickLinks').show();
$('nav .container').show(); // Show top nav content
$('aside div').show(); // Show left menu content
$('aside ul').show(); // Show left menu content
$('aside .sub-menu ul').css('display', 'none'); // Collapse all Left menu items
    //$('#leftAd').show();
    //$('#footer').show();
// Old UI
$('#liveMatchContent').show();
$('#adslot_1').show();
$('#adslot_1').css('visibility', 'visible');
$('#adslot_top').show();
  }
};

Ads.prototype.onAdEvent_ = function(adEvent) {
  this.application_.log('Ad event: ' + adEvent.type);

  if (adEvent.type == google.ima.AdEvent.Type.CLICK) {
    this.application_.adClicked();
  }

   if (adEvent.type == google.ima.AdEvent.Type.USER_CLOSE) {
if (this.adsManager_) {
  this.adsManager_.destroy();
}
$('#videocontainer').hide();
$('#MatchCommentaryScreen').show();
$('#quickLinks').show();
$('nav .container').show(); // Show top nav content
$('aside div').show(); // Show left menu content
$('aside ul').show(); // Show left menu content
$('aside .sub-menu ul').css('display', 'none'); // Collapse all Left menu items
//$('#leftAd').show();
//$('#footer').show();
// Old UI
$('#liveMatchContent').show();
$('#adslot_1').show();
$('#adslot_1').css('visibility', 'visible');
$('#adslot_top').show();
    }

    if (adEvent.type == google.ima.AdEvent.Type.SKIPPED) {
if (this.adsManager_) {
  this.adsManager_.destroy();
}
$('#videocontainer').hide();
$('#MatchCommentaryScreen').show();
$('#quickLinks').show();
$('nav .container').show(); // Show top nav content
$('aside div').show(); // Show left menu content
$('aside ul').show(); // Show left menu content
$('aside .sub-menu ul').css('display', 'none'); // Collapse all Left menu items
//$('#leftAd').show();
//$('#footer').show();
// Old UI
$('#liveMatchContent').show();
$('#adslot_1').show();
$('#adslot_1').css('visibility', 'visible');
$('#adslot_top').show();
if (this.adsManager_) {
  this.adsManager_.destroy();
}
    }

    if (adEvent.type == google.ima.AdEvent.Type.COMPLETE) {
if (this.adsManager_) {
  this.adsManager_.destroy();
}
$('#videocontainer').hide();
$('#MatchCommentaryScreen').show();
$('#quickLinks').show();
$('nav .container').show(); // Show top nav content
$('aside div').show(); // Show left menu content
$('aside ul').show(); // Show left menu content
$('aside .sub-menu ul').css('display', 'none'); // Collapse all Left menu items
//$('#leftAd').show();
//$('#footer').show();
// Old UI
$('#liveMatchContent').show();
$('#adslot_1').show();
$('#adslot_1').css('visibility', 'visible');
$('#adslot_top').show();
    }

    if (adEvent.type == google.ima.AdEvent.Type.ALL_ADS_COMPLETED) {
if (this.adsManager_) {
  this.adsManager_.destroy();
}
$('#videocontainer').hide();
$('#MatchCommentaryScreen').show();
$('#quickLinks').show();
$('nav .container').show(); // Show top nav content
$('aside div').show(); // Show left menu content
$('aside ul').show(); // Show left menu content
$('aside .sub-menu ul').css('display', 'none'); // Collapse all Left menu items
//$('#leftAd').show();
//$('#footer').show();
// Old UI
$('#liveMatchContent').show();
$('#adslot_1').show();
$('#adslot_1').css('visibility', 'visible');
$('#adslot_top').show();
    }
};

Ads.prototype.onAdError_ = function(adErrorEvent) {
  this.application_.log('Ad error: ' + adErrorEvent.getError().toString());
  if (this.adsManager_) {
    this.adsManager_.destroy();
  }
  //this.application_.resumeAfterAd();
    $('#videocontainer').hide();
    $('#MatchCommentaryScreen').show();
$('#quickLinks').show();
$('nav .container').show(); // Show top nav content
$('aside div').show(); // Show left menu content
$('aside ul').show(); // Show left menu content
$('aside .sub-menu ul').css('display', 'none'); // Collapse all Left menu items
    //$('#leftAd').show();
    //$('#footer').show();
// Old UI
$('#liveMatchContent').show();
$('#adslot_1').show();
$('#adslot_1').css('visibility', 'visible');
$('#adslot_top').show();
};

// Copyright 2013 Google Inc. All Rights Reserved.
// You may study, modify, and use this example for any purpose.
// Note that this example is provided "as is", WITHOUT WARRANTY
// of any kind either expressed or implied.

/**
 * Handles video player functionality.
 */
var VideoPlayer = function() {
  this.contentPlayer = document.getElementById('videocontent');
  this.adContainer = document.getElementById('adcontainer');
  this.videoPlayerContainer_ = document.getElementById('videoplayer');

  this.width = 640;
  this.height = 360;
  
};

VideoPlayer.prototype.preloadContent = function(contentLoadedAction) {
//  // If this is the initial user action on iOS or Android device,
//  // simulate playback to enable the video element for later program-triggered
//  // playback.
  if (this.isMobilePlatformiPhone()) {
//    this.contentPlayer.addEventListener(
//        'loadedmetadata',
//        contentLoadedAction,
//        false);
//    this.contentPlayer.load();
// contentLoadedAction();


    $('#videocontainer').hide();
    $('#MatchCommentaryScreen').show();
$('#quickLinks').show();
$('nav .container').show(); // Show top nav content
$('aside div').show(); // Show left menu content
$('aside ul').show(); // Show left menu content
$('aside .sub-menu ul').css('display', 'none'); // Collapse all Left menu items
    //$('#leftAd').show();
    //$('#footer').show();
// Old UI
$('#liveMatchContent').show();
$('#adslot_1').show();
$('#adslot_1').css('visibility', 'visible');
$('#adslot_top').show();
  } else {
    contentLoadedAction();
  }
};

};

VideoPlayer.prototype.pause = function() {
  this.contentPlayer.pause();
};

VideoPlayer.prototype.isMobilePlatformiPhone = function() {
  return this.contentPlayer.paused &&
      (navigator.userAgent.match(/iPhone/));
};

VideoPlayer.prototype.isMobilePlatform = function() {
  return this.contentPlayer.paused &&
      (navigator.userAgent.match(/(iPod|iPhone|iPad)/) ||
       navigator.userAgent.toLowerCase().indexOf('android') > -1);
};

VideoPlayer.prototype.resize = function(
    position, top, left, width, height) {
  this.videoPlayerContainer_.style.position = position;
  this.videoPlayerContainer_.style.top = top + 'px';
  this.videoPlayerContainer_.style.left = left + 'px';
  this.videoPlayerContainer_.style.width = width + 'px';
  this.videoPlayerContainer_.style.height = height + 'px';
  this.contentPlayer.style.width = width + 'px';
  this.contentPlayer.style.height = height + 'px';
};

VideoPlayer.prototype.registerVideoEndedCallback = function(callback) {
  this.contentPlayer.addEventListener(
      'ended',
      callback,
      false);
};

var application = null;

Igor

unread,
Apr 24, 2018, 12:49:02 PM4/24/18
to Interactive Media Ads SDK
Hey Peter!

I'm also interested what should be done in order to comply with new Chrome policy.
I think, one thing is missing in your code, that was mentioned in Adsense email:
For publishers using IMA SDK, update the IMA SDK AdRequest to include two new mandatory fields: setAdWillAutoPlay and setAdWillPlayMuted.
Have you tried adding these fields?

Peter Adams

unread,
Apr 24, 2018, 1:56:48 PM4/24/18
to Interactive Media Ads SDK
Hi Igor

Thanks I will try th we fields tomorrow.

Peter

ima-sdk-adv...@google.com

unread,
Apr 24, 2018, 3:13:44 PM4/24/18
to ima...@googlegroups.com
Hi Peter,

I would suggest that you try adding those fields that Igor has mentioned. You should also try muting the ads before you call adsManager.start(). Another option would be to add the 'muted' attribute to your HTML5 video element. If you continue to have issues, you'll need to reach out to your serving provider. The error message you shared tells me that the SDK is receiving an empty VAST response. Therefore the ad server isn't sending an ad to play.

Regards,
Chris Feldman
IMA SDK Team

=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+ page:
    http://googleadsdeveloper.blogspot.com
    https://plus.google.com/115658573333388777174/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

--
You received this message because you are subscribed to the Google Groups "Interactive Media Ads SDK" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ima-sdk+unsubscribe@googlegroups.com.
To post to this group, send email to ima...@googlegroups.com.
Visit this group at https://groups.google.com/group/ima-sdk.
For more options, visit https://groups.google.com/d/optout.

Peter Adams

unread,
Apr 25, 2018, 4:15:25 AM4/25/18
to Interactive Media Ads SDK
Hi Chris

Many thanks for your reply.

I have removed the setAdWillAutoPlay and setAdWillPlayMuted before the call to start and added the "muted" attibute to the <video> tag. An advert was requested and played muted.
However, my button to set the volume was thorwing an error. I am now not seeing any adverts to test setting the volume setVolume(1);

Thanks.

Regards
Peter

Peter Adams

unread,
Apr 25, 2018, 7:06:14 AM4/25/18
to Interactive Media Ads SDK
I am using the id="fullscreen" button from the Google IMA advanced example.

This is my code when the full screen button is clicked.

Application.prototype.onFullscreenClick_ = function() {
this.adsManager_.setVolume(1);
};

What is the required code to enable sound?

Thanks.

ima-sdk-adv...@google.com

unread,
Apr 25, 2018, 3:12:40 PM4/25/18
to ima...@googlegroups.com
Hi Peter,

That is the proper way to change the volume and enable sound. You mentioned that you were getting an error, can you share the message? That might shed some more light on the issue.

Regards,
Chris Feldman
IMA SDK Team

=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+ page:
    http://googleadsdeveloper.blogspot.com
    https://plus.google.com/115658573333388777174/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

--

Peter Adams

unread,
Apr 25, 2018, 3:40:36 PM4/25/18
to Interactive Media Ads SDK
Hi

Thanks for your email.

The error was something like setVolume() is a property of null.

This means the this.adsManager_ is null?

I just want to use the Full Screen button (I’ve changed the Unicode character to be a speaker Unicode character) and Call the setVolume() of the adsManager to enable sound.

Many thanks for your help.

Regards
Peter

ima-sdk-adv...@google.com

unread,
Apr 26, 2018, 2:06:52 PM4/26/18
to ima...@googlegroups.com
Hi Peter,

Based on the error, it does sound like your adsManager variable is null. Please review your implementation to ensure you're only calling methods on variables that you've initialized. I'd suggest also taking a look at our samples.

Regards,
Chris Feldman
IMA SDK Team

=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+ page:
    http://googleadsdeveloper.blogspot.com
    https://plus.google.com/115658573333388777174/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Peter Adams

unread,
Apr 27, 2018, 9:54:38 AM4/27/18
to Interactive Media Ads SDK
Hi Chris

I was still getting the following error:

Ad error: AdError 901: An unexpected error occurred within the VPAID creative. Refer to the inner error for more info.

But after adding the following:

this.adsLoader_.getSettings().setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED);
this.adsLoader_.getSettings().setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.INSECURE);  

I now get adverts loading every time which is much more frequently than before the sound is muted due to the muted attribute on the <video> tag.

I just need to find example code on how to set the volume. 

I have had a look at the Advanced example, our code is based on this, and there is no example on how to set / turn the sound back on?

Thanks.

Regards
Peter

ima-sdk-adv...@google.com

unread,
Apr 27, 2018, 11:54:42 AM4/27/18
to ima...@googlegroups.com
Hi Peter,

If you're seeing less errors while using the INSECURE VPAID mode, that likely means that your ads require access to the page DOM. You can take a look at this page for more information about iframe security and VPAID creatives.

Regarding your issue with volume, as long as you're using the API correctly, adsManager.setVolume(1) should do the trick. For example, if I add the 'muted' attribute to our Advanced Sample then calling this.adsManager_.setVolume(1) works to unmute the ad.

If you continue to have issues, you can feel free to share a link to your page. That should allow me to get a better idea of what's going on.

Regards,
Chris Feldman
IMA SDK Team

=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+ page:
    http://googleadsdeveloper.blogspot.com
    https://plus.google.com/115658573333388777174/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Peter Adams

unread,
May 1, 2018, 3:25:42 AM5/1/18
to Interactive Media Ads SDK
Hi Chris

Many thanks for your reply.

Regarding Insecure Vpaid mode, I have tried not making the call below:

this.adsLoader_.getSettings().setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.INSECURE); 

but this throws a 901 error. I'm not sure what to do to not use the above.

I have added the call to:

this.adsManager_.setVolume(1)

but this didn't work.

To try this out, if you go to https://www.soccermanager.com and register and on the https://www.soccermanager.com/game.php select the Worlds game, then take control of a club of your choice.
On this page https://www.soccermanager.com/multiplayer.php click on your club and then click on the View Match button within the box called LAST FIXTURE.

If you have problems setting this up let me know and I can then send you login details of my test account, thank you.

Many thanks for your help.

Regards
Peter

ima-sdk-adv...@google.com

unread,
May 1, 2018, 11:37:29 AM5/1/18
to ima...@googlegroups.com
Hi Peter,

It's not a problem that you're using INSECURE. I just wanted to make you aware that you were likely using ads that required this setting and that's why you were seeing errors without it.

As for setVolume, I loaded your game and followed the steps you outlined. However, I wasn't able to see an ad play. Your code is also obfuscated, which makes it difficult to debug the issue. Are you able to reproduce the setVolume issue in one of our sample players (link)? I'd suggest modifying our basic or advanced sample to match your workflow and then testing with that. If you're able to reproduce the issue, it'll be much easier for me to get an idea of what the problem is with code I'm already familiar with.

Regards,
Chris Feldman
IMA SDK Team

=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+ page:
    http://googleadsdeveloper.blogspot.com
    https://plus.google.com/115658573333388777174/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Peter Adams

unread,
May 2, 2018, 10:30:54 AM5/2/18
to Interactive Media Ads SDK
Hi Chris

Many thanks for your help.
I have created a test page that calls this.adsManager_.setVolume(1) when the video is paused, and unpaused the sound works (using the Advanced Sample Tag).
However, every time I enter our VPAID tag:

https://ima3vpaid.appspot.com/?adTagUrl=https%3A%2F%2Fgoogleads.g.doubleclick.net%2Fpagead%2Fads%3Fclient%3Dca-video-pub-9385833105515294%26slotname%3D3886561090%26ad_type%3Dskippablevideo%26description_url%3Dhttp%253A%252F%252Fwww.soccermanager.com%252Fdescription.html%26videoad_start_delay%3D0&type=js

The response in the id="console" is:

Ads loaded.
Ad error: AdError 901: An unexpected error occurred within the VPAID creative. Refer to the inner error for more info. Caused by: Error: Error: AdError 1009 (The VAST response document is empty.): AdError 1009: The VAST response document is empty.

I then added the following lines for the iframe security issue

// Set VPAID Mode to Enabled
this.adsLoader_.getSettings().setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED);
this.adsLoader_.getSettings().setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.INSECURE);

Now and advert is requested and loads, however, clicking the pause button twice does not enable sound. This is what is happening within our game.

All of the HTML, CSS and JS are all inlined in the HTML document for ease of debugging: https://www.soccermanager.com/ima_ads_advanced.html
No javascript errors are thrown.


Many thanks for your help.

Regards
Peter

ima-sdk-adv...@google.com

unread,
May 2, 2018, 3:13:07 PM5/2/18
to ima...@googlegroups.com
Hi Peter,

Thank you for taking the time to set up the test page. Based on the behavior, I think the issue you're seeing is being caused by some problem with the VPAID creative. The sample ad tags from here load correctly and mute/unmute as intended. However, when I try to play your ad I get an error 901, which points to an issue with the VPAID creative. I'd suggest reaching out to your creative provider so they can resolve the issue with their ad.

Regards,
Chris Feldman
IMA SDK Team

=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+ page:
    http://googleadsdeveloper.blogspot.com
    https://plus.google.com/115658573333388777174/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Peter Adams

unread,
May 3, 2018, 2:08:55 AM5/3/18
to Interactive Media Ads SDK


Many thanks for your time looking at the sample page I created.

When you say “reach out to your creative provider” I’m not sure what you mean as we do not have one, the VPAID tag was setup via Google Ad Exchange > Games and I have enabled all technology as types. Is there a team at Google I can reach out too?

Many thanks for your time and help.

Regards
Peter

ima-sdk-adv...@google.com

unread,
May 3, 2018, 2:55:04 PM5/3/18
to ima...@googlegroups.com
Hi Peter,

If your tags were setup via Ad Exchange, you can contact the Publisher Support team via the CONTACT US button on this page.

Regards,
Chris Feldman
IMA SDK Team

=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+ page:
    http://googleadsdeveloper.blogspot.com
    https://plus.google.com/115658573333388777174/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Peter Adams

unread,
May 4, 2018, 2:53:18 AM5/4/18
to Interactive Media Ads SDK
Hi Chris

I have submitted a response referring to this thread.

Once again, many thanks for your help.

Regards
Peter

Peter Adams

unread,
May 6, 2018, 7:02:47 PM5/6/18
to Interactive Media Ads SDK
Hi Chris,

I have just received a reply from the Google AdSense support team and they have said "Unfortunately, we are not currently supporting this genre of question. However there are many other resources available that may lead you to the answer you are looking for. A good place to start is our AdX help center where you can use the search functionality to direct you to related questions."

I would really like a simple solution to this problem with not being able to unmute the sound especially with the World Cup coming soon.

Regards
Peter

ima-sdk-adv...@google.com

unread,
May 7, 2018, 11:39:34 AM5/7/18
to ima...@googlegroups.com
Hi Peter,

I still think that it's unlikely this is an SDK issue. There's almost certainly an issue with your ad. Since you're using AdX with an IMA adapter tag, you may want to try DFP's suggested remediation for a VAST Error 901:

This can occur when the "IMA Adapter" tag from Ad Exchange is used with the IMA SDK, and a VPAID ad is returned. You should use the "Direct SDK" tag from Ad Exchange when using the IMA SDK.

Regards,
Chris Feldman
IMA SDK Team 

=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+ page:
    http://googleadsdeveloper.blogspot.com
    https://plus.google.com/115658573333388777174/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Peter Adams

unread,
May 7, 2018, 12:30:40 PM5/7/18
to Interactive Media Ads SDK
Thanks I will regenerate the ad tag as you suggest.

Thanks.

Regards
Peter

Peter Adams

unread,
May 8, 2018, 4:28:49 AM5/8/18
to Interactive Media Ads SDK
Hi Chris

I have changed the ad tag and that has worked.

Many many thanks for your help.

Regards
Peter

Igor

unread,
May 8, 2018, 1:28:56 PM5/8/18
to Interactive Media Ads SDK
So...it looks like you've solved all you problems and I can ask my questions now. :)

In order to comply with this new policy what should I do exactly?
Is that enough?
adsRequest.setAdWillAutoPlay(true);
adsRequest.setAdWillPlayMuted(true);
...
adsManager.setVolume(0);
Thank you!

ima-sdk-adv...@google.com

unread,
May 8, 2018, 3:22:30 PM5/8/18
to ima...@googlegroups.com
Hi,

I'm glad that this is now working for you. If you're using muted autoplay, you will want to use those methods to signal in your ad request that you're doing so. However, for any more specific policy questions, you'll need to reach out to Publisher Support. I'm not able to comment on policy on this forum.

Regards,
Chris Feldman
IMA SDK Team

=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+ page:
    http://googleadsdeveloper.blogspot.com
    https://plus.google.com/115658573333388777174/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

--
Reply all
Reply to author
Forward
0 new messages