AdError 402 on android

243 views
Skip to first unread message

ugur

unread,
Dec 8, 2015, 11:04:53 AM12/8/15
to Interactive Media Ads SDK

As the subject says, I'm receiving the AdError 402 on android phones. I've read all similar topics here and tried almost every suggestion but still no luck . When I request video ads, the player goes black and after 15 seconds I receive the mentioned error. My player implementation is loaded asynchronously and configured through a site management console, so I do not have a simple version of it which I can share here yet, but this is basically how my implementation works:

  1. A script tag is created in DOM and ima3.js is loaded asynchronously, 
  2. Once SDK is loaded, an HTML video player is created dynamically.
  3. Appending the video player to the DOM loads the video and triggers video player's loadedmetadata event, which sets the playerInitialized flag to true
  4. User clicks the play button on HTML video's built in controls, triggering the play event
  5. play event sets playerClicked flag to true, initializes the adDisplayContainer, creates an adsLoader and calls adsLoader.requestAds method
  6. google.ima.AdEvent.Type.LOADED event is triggered which sets the adInitialized flag to true and calls my custom adStart method.
  7. adStart method checks if playerInitialized, playerClicked and adInitialized are true and calls the  adsManager.start() method.
You will see log output of the player below, is there anything wrong with the flow? I have not implemented custom playback yet, but since I'm testing the player on Android 5.0, I guess that should not be the issue.



Chrome on Desktop

Loading SDK
SDK onLoad event triggered, creating HTML video player
Created HTML video player
Video loadedmetadata event triggered

Ad Start Check, Event : video loadedmetadata
Flag Status : playerInitialized=true, playerClicked=false, adInitialized=false, adStarted=false
Flags Not Ready 
 
Play Button Clicked
Video play event triggered
Initialized google.ima.AdDisplayContainer 
Created google.ima.adLoader 
Created google.ima.adRequest
adRequest ready, calling adLoader.requestAds

Ad Start Check, Event : video play
Flag Status : playerInitialized=true, playerClicked=true, adInitialized=false, adStarted=false
Flags Not Ready 
 
onAdsManagerLoaded event triggered
Initialized adsManager
onAdEvent triggered, Event Type : ad loaded

Ad Start Check, Event : ad load
Flag Status : playerInitialized=true, playerClicked=true, adInitialized=true, adStarted=false
Flags Ready, calling adsManager.start()
 
onAdEvent triggered, Event Type : ad start
onAdEvent triggered, Event Type : ad complete



Chrome on Android 5.0 Device

Loading SDK
SDK onLoad event triggered, creating HTML video player
Created HTML video player
Video loadedmetadata event triggered

Ad Start Check, Event : video loadedmetadata
Flag Status : playerInitialized=true, playerClicked=false, adInitialized=false, adStarted=false
Flags Not Ready 
 
Play Button Clicked
Video play event triggered
Initialized google.ima.AdDisplayContainer 
Created google.ima.adLoader 
Created google.ima.adRequest
adRequest ready, calling adLoader.requestAds

Ad Start Check, Event : video play
Flag Status : playerInitialized=true, playerClicked=true, adInitialized=false, adStarted=false
Flags Not Ready 
 
onAdsManagerLoaded event triggered
Initialized adsManager
onAdEvent triggered, Event Type : ad loaded

Ad Start Check, Event : ad load
Flag Status : playerInitialized=true, playerClicked=true, adInitialized=true, adStarted=false
Flags Ready, calling adsManager.start()
 
Ad Error : 402 - VAST media file loading reached a timeout of 15 seconds.



ugur

unread,
Dec 8, 2015, 11:26:47 AM12/8/15
to Interactive Media Ads SDK

I've tested my player using my own ad tags and all linear tags found on https://developers.google.com/interactive-media-ads/docs/sdks/html5/tags, same result.

Also,I've tried testing the sample players found on https://github.com/googleads/googleads-ima-html5/releases 
Simple player goes blank and doesn't even load any content video or ad.
Advanced player with sample ad tag also goes blank and starts playing the content video after receiving the same 402 error.

Tyler Sidell (IMA SDK Team)

unread,
Dec 8, 2015, 4:48:52 PM12/8/15
to Interactive Media Ads SDK
Hi Ugur,

Thank you for providing detailed information.  Would you be able to send us your ad tag (reply privately to the author if you feel more comfortable)?  One thing that I am noticing is that in the following setup you are initializing the adDisplayContainer via the play event.  You should be initializing from the user action instead. For HTML5 SDK implementations, video playback must be initialized through a user action (such as a tap or click) on mobile web. 
User clicks the play button on HTML video's built in controls, triggering the play event
play event sets playerClicked flag to true, initializes the adDisplayContainer, creates an adsLoader and calls adsLoader.requestAds method

Anyway, can you please send us your ad tag so that we can take a look further?

Thanks,
Tyler Sidell
IMA SDK Team

ugur

unread,
Dec 8, 2015, 6:35:00 PM12/8/15
to Interactive Media Ads SDK
Hi Tyler, 

I've tested my player using all sample linear tags found on https://developers.google.com/interactive-media-ads/docs/sdks/html5/tags, they work fine on desktop but I get the error on mobile device.

In my implementation, user clicks the built-in play button of <video> (user action?) and triggers my custom play event (simplified version below), the video is not played automatically when it loads. Do I have to use a custom play button to play the video? 

Besides, I do not think this is the reason because I've tested the latest sample video player found on  https://github.com/googleads/googleads-ima-html5/releases, without any modifications and I got the same error, a device issue maybe?


videoPlayer.addEventListener('play', function(){
     addLog('Play Button Clicked');
     addLog('Video play event triggered');
     if(!displayContainerInitialized){
          createAdDisplayContainer();
          requestAds();
      }
      playerStarted=true;
});


According to Playing mobile video ads with the IMA HTML5 SDK, simple approach is 

  1. User clicks to start playback.
  2. AdDisplayContainer is initialized.
  3. Content <video> element is initialized, waiting for the loadedmetadata event.
  4. Once the loadedmetadata event is received, ads are requested.
But adding a <video src="video url"></video> tag to the HTML source triggers the loadedmetadata event before user clicks the custom/built-in play button. Do you think this is the reason? Do I have to set the src attribute of <video> after a user click? 

I guess using ima3_debug.js will provide some useful info but I can see the log only on desktop and everything is fine on desktop browser. Is there a way to see the log output of ima3_debug.js on mobile devices too? 

Tyler Sidell (IMA SDK Team)

unread,
Dec 9, 2015, 10:15:55 AM12/9/15
to Interactive Media Ads SDK
Hi Ugur,

If you are also seeing the issue with our sample tags in our advanced demo, then it wouldn't be specific to anything in your implementation.  However, we've tested on Android 5.0 and 6.0 with the same scenario and ad playback was present and no AdError 402 occurred.  Without a consistent way to reproduce, it wouldn't be feasible to troubleshoot.  This scenario leads me to believe that it may be a network connection issue or even device specific.  If you could try to reproduce the issue on other devices please let us know.

I would suggest using ima3_debug.js, conducting the following steps to debug and see if there are additional errors in the console. 

Thanks,
Tyler Sidell
IMA SDK Team

ugur

unread,
Dec 9, 2015, 11:14:08 AM12/9/15
to Interactive Media Ads SDK
Hi Tyler,

I've also tried Video Suite Inspector with sample tags and got same output, looks like it's a device specific issue. I'll try again with remote debugging enabled to see what's going on and will let you know if I can find anything

Tyler Sidell (IMA SDK Team)

unread,
Dec 9, 2015, 11:16:48 AM12/9/15
to Interactive Media Ads SDK
Hi Ugur,

Thanks for the feedback.  We've aren't able to reproduce it with the tools or sample examples.  Please let us know the results of the remote debugging.

Cheers,
Tyler Sidell
IMA SDK Team

ugur

unread,
Dec 9, 2015, 11:29:14 AM12/9/15
to Interactive Media Ads SDK
Lenovo A7000, Android 5.0, Advanced sample player with debugging enabled, sample ad tag is used and this is the log output. 

bridge3.115.0_debug_en.html:332  [  2.752s] [ima.loader.AdsLoaderWrapper] Requesting ads using new ads loader.
bridge3.115.0_debug_en.html:332  [  2.770s] [ima.loader.AdsLoaderWrapper] requestAds, processing external request.
bridge3.115.0_debug_en.html:332  [  2.780s] [ima.loader.SequentialAdsLoader] Enqueued new request.
bridge3.115.0_debug_en.html:332  [  2.782s] [ima.loader.SequentialAdsLoader] Starting request from queue.
bridge3.115.0_debug_en.html:332  [  2.784s] [ima.loader.AdsLoaderImpl] creating instance of GptRequestActivity.
bridge3.115.0_debug_en.html:332  [  2.792s] [ima.loader.AdSourceFetcher] fetch, starting GPT request activity.
bridge3.115.0_debug_en.html:332  [  2.799s] [ima.request.GptRequestActivity] Page correlator from GPT: 2236832609730560
bridge3.115.0_debug_en.html:332  [  2.801s] [ima.request.GptRequestActivity] Video stream correlator from GPT: 296843254693888
bridge3.115.0_debug_en.html:332  [  2.803s] [ima.request.GptRequestActivity] Started roadblock task.
bridge3.115.0_debug_en.html:332  [  2.806s] [ima.request.GptRequestActivity] Content {vid: "", cmsid: ""} empty.
bridge3.115.0_debug_en.html:332  [  3.196s] [ima.loader.AdSourceFetcher] Creating WaterfallAdSource.
bridge3.115.0_debug_en.html:332  [  3.201s] [ima.loader.VastAdSource] hasMoreAds, this.ads.length: 1 , this.currentAdIndex: -1 , this.numAdsSent: 0
bridge3.115.0_debug_en.html:332  [  3.203s] [ima.loader.VastAdSource] getNextAd, this.currentAdSource: null
bridge3.115.0_debug_en.html:332  [  3.205s] [ima.loader.VastAdSource] hasMoreAds, this.ads.length: 1 , this.currentAdIndex: -1 , this.numAdsSent: 0
bridge3.115.0_debug_en.html:332  [  3.207s] [ima.loader.VastAdSource] processNextAd_, currentAdIndex: 0, ads.length: 1
bridge3.115.0_debug_en.html:332  [  3.209s] [ima.loader.VastAdSource] Setting fallback index to session context: 0
bridge3.115.0_debug_en.html:332  [  3.213s] [ima.loader.VastAdSource] processInlineAd, successCallback with 1 ads
bridge3.115.0_debug_en.html:332  [  3.214s] [ima.loader.VastAdSource] hasMoreAds, this.ads.length: 1 , this.currentAdIndex: 0 , this.numAdsSent: 1
bridge3.115.0_debug_en.html:332  [  3.216s] [ima.loader.AdsLoaderImpl] exhaustAdSource_, calling success for 1 ads
bridge3.115.0_debug_en.html:332  [  3.218s] [ima.loader.AdsLoaderWrapper] dispatchAdsManagerLoadedEvent_, ads.length: 1
bridge3.115.0_debug_en.html:332  [  3.223s] [ima.managers.AdsManagerFactory] createAdsManager, adType: video
bridge3.115.0_debug_en.html:332  [  3.251s] [ima.loader.SequentialAdsLoader] Starting request from queue.
application.js:71 Ads loaded.
application.js:71 Ad event: loaded
bridge3.115.0_debug_en.html:332  [ 19.077s] [ima.vast.VideoAdEventTracker] dispatching event mediaLoadTimeout
bridge3.115.0_debug_en.html:332  [ 19.092s] [ima.managers.VastVideoAdsManager] Playback error: VAST media file loading reached a timeout of {0} seconds. 402 AdError 402: VAST media file loading reached a timeout of 15 seconds.
bridge3.115.0_debug_en.html:332  [ 19.125s] [ima.common.ErrorUtils] Error play dispatched: AdError 402: VAST media file loading reached a timeout of 15 seconds.
application.js:71 Ad error: AdError 402: VAST media file loading reached a timeout of 15 seconds.

Tyler Sidell (IMA SDK Team)

unread,
Dec 9, 2015, 4:53:25 PM12/9/15
to Interactive Media Ads SDK
Hi Ugur,

Thank you for sending us the log output.  However, there is nothing that stands out from the logs that would lead to the AdError 402.  I do believe it could be a device specific issue.  We've tested on multiple devices on our end but was not able to reproduce the issue.  
  • Would you be able to test on a different device to see if you are getting the same results on your end?
  • Do you have any proxies or firewalls set up?
  • What happens if you try this scenario on Wifi vs a cellular connection?
Cheers,
Tyler Sidell
IMA SDK Team

Reply all
Reply to author
Forward
0 new messages