googleads / videojs-ima

IMA SDK Plugin for Video.js
Apache License 2.0
450 stars 284 forks source link

VAST 900:1021 doesn't trigger the ads-ima-adError event which makes the ad controls and events persist #714

Closed minasaywhat closed 4 years ago

minasaywhat commented 6 years ago

We've been trying to troubleshoot this issue in our player where the ad controls persist when the ad fails and the video content plays. We've been going back and forth with our demand partner trying to pinpoint if this is a bug in our player vs a bug in their ad tag wrapper. One of their engineers pointed out the root cause this morning - and figured out a way to handle it, but I'm posting this here because it seems a fix is also needed in the videojs IMA SDK.

It looks like our ads team has a problem with the fallback ad we have configured in DFP - so the expectation would be for the IMA SDK to return the adError event. However, the ad error event never gets triggered, even though the fallback ad fails. Hence, the player doesn't get the trigger to remove the ad controls - and the ad events are all firing during the video content playback instead of the played events.

Here's a test link to see this in action: http://glimmer.hearstapps.com/api.html?embedId=cce3f0c1-d723-437d-b581-fd866da0b523&dataLayer=none&adTag=&aspectRatio=16%3A9&volume=1&muted=on&autoplay=on&token=rubicontest

The Rubicon dev team added a special condition/handler for this to force or trigger the adError event when the VAST 900:1021 event occurs (The fallback failed to return an ad), but it seems this should be handled natively in the IMA SDK. Do you agree?

I was also trying to find the docs on these more detailed VPAID error codes, and I couldn't find them in the Google DFP docs online, or in the IAB VAST or VPAID standards docs. This is the only link I could find with a legend of this specific ad error code. Does Google/DFP or IAB have these error codes published anywhere (just curious)? https://watchingthat.com/ima3-vast41-brightcove-jw-ad-error-codes/

Thanks in advance for your help with this issue. Mina

minasaywhat commented 6 years ago

rubicon-ima-fallback-ad-error

The suggested fix from the Rubicon dev team to handle this error/use case in the player:

i.prototype.initAdObjects = function() { 

this.adsManager.addEventListener(google.ima.AdEvent.Type.AD_BREAK_READY, this.onAdBreakReady.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.LOG, this.onAdLog.bind(this)), this.adsManager.addEventListener(google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED, this.onContentPauseRequested.bind(this)),

i.prototype.onAdLog = function(e) { var d = e.getAdData();if (d['adError']&&d['adError'].h == 1021) { this.onAdError(d['adError'].g) }}, i.prototype.onAdsLoaderError = function(e) { window.console.warn("AdsLoader error: " + e.getError()), this.controller.onErrorLoadingAds(e), this.adsManager && this.adsManager.destroy() },
grobolom commented 6 years ago

This is related to #707 .

VFarrar commented 6 years ago

@ypavlotsky I wanted to follow up on this issue. Any insights or thoughts on the proposed solution?

oharlem commented 6 years ago

@ypavlotsky Hi Yury, we desperately need your help, guys! We have an "all hands on deck" situation as of this morning, caused by the logic described by Mina and Vasja above, and the situation is quite time sensitive.

Any piece of advice from you is really really appreciated

Thank you! Dennis

mysuf commented 6 years ago

If you need hotfix asap, I would try something like this:

.....
player.ima(options);
player.on('adslog', function(event) {
  const adData = event.data.AdEvent.getAdData();
  // force the adError event when VAST 900:1021 occurs
  if (adData.adError && adData.adError.getErrorCode() === 1021) {
    player.ima.controller.sdkImpl.onAdError(adData.adError.getInnerError());
  }
};
oharlem commented 6 years ago

@mysuf Thank you!

grobolom commented 6 years ago

@mysuf awesome, thanks for the suggestions. @ypavlotsky would it be possible to ask for a release of the latest videojs-ima version? I don't know the exact process but it would be great to have the latest code, since the fix suggested here seems to only be available with a PR that was merged after 1.5.1 was released. If I should ask somewhere else please let me know, and thanks again for the help.

mysuf commented 6 years ago

Ah. I didnt realize that triggering adslog is new feat..sorry.. Its still possible, but with little more code:

function onImaAdsLog(adEvent) {
  const adData = adEvent.getAdData();
  // force the adError event when VAST 900:1021 occurs
  if (adData.adError && adData.adError.getErrorCode() === 1021) {
    this.onAdError(adData.adError.getInnerError());
  }
}

player.ima({adsManagerLoadedCallback: function () {
  player.ima.controller.sdkImpl.adsManager.addEventListener(
    google.ima.AdEvent.Type.LOG,
    onImaAdsLog.bind(player.ima.controller.sdkImpl)
  );
}});

Note that I write it without any testing so it can contain typos etc..

grobolom commented 6 years ago

@mysuf no worries about the testing, this is super helpful. We'll give it a shot in the interim, thanks a bunch! :)

ypavlotsky commented 5 years ago

Is still happening or have you implemented a workaround in your test page? I'm not seeing an error on the test page. Note that if you're playing a playlist of ads, ad errors will become AdEvent.Type.LOGs so that the SDK can continue playing the next ad in the playlist. Is that what you're seeing?

opinxit commented 5 years ago

The offending ad tag wrappers were disabled on our side, and we have not seen the behavior since then. We have made some other changes with respect to some ad/content player freezing issues (most notably here: https://github.com/googleads/videojs-ima/issues/735), so not sure what would happen if the ad tag wrappers that were problematic were to be re-enabled.

Btw, when will the 1.5.2 release (with the changes to ad logging mentioned in this thread) be released publicly? npm still lists 1.5.1 as the most recent public release.

Kiro705 commented 4 years ago

Hi all,

It looks as though this issue may have been resolved, but it is possible that the underlying issue of the ads-ima-adError event not triggering still exists.

I am closing the issue, but please reopen if you have the reproducible example of this issue.

sunilstg commented 4 years ago

Hi All, Can you please advise how to listen complete IMA SDK AdErrorEvent for any error. Right now on "adserror" event not giving me any error code and video resuming successfylly. Also I can see adsready event working as expected. Please help on this with complete ads error similar to google.ima.AdErrorEvent.Type.AD_ERROR, onAdError

https://developers.google.com/interactive-media-ads/docs/sdks/html5?hl=hi#!topic/ima-sdk/Nc1fDYKYFik

sunilstg commented 4 years ago

Also I am seeing that Ads timeout coming first than "ads-load" event firing and resuming video and after that no ad error I am receiving.