question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Resend AD request with "onLoad" requestMode

See original GitHub issue

I’m trying to do some waterfall model with using two ad_tags, with reloading I’m trying to do it in that way:

let adConfig = {
requestMode: "onLoad",
adTagUrl: "FIRST_URL";
}
this.player.ima (adConfig);
............
player.on ('adserror', (event) => {
   this.player.ima.initializeAdDisplayContainer ();
   this.player.ima.setContentWithAdTag (null, "SECOND_URL", true);
   this.player.ima.requestAds ();
});

Using “onPlay” requestMode everything is fine, when click play, player try to load “FIRST_URL”, and if for example when ADError: 1009 was happen, it send request to SECOND_URL, and plays the ads from second tag without problems

But when the requestMode is set to “onLoad” (to prefetch the ads), If any aderror was triggered, even if the SECOND_URL ad tag is requested, and downloaded properly, videojs-ima doesn’t play te ads from the SECOND_URL. It simply starts my video without any errors in console

If I add the play () function directly after the this.player.ima.requestAds ();, or I have an autoplay in my player, it works fine, so that could be related to some timeouts?

Maybe it will be an option to reload whole videojs-ima plugin for that? How to achieve it?

And another simple question. Is it posible to get an AD XML content from the plugin code?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
Kiro705commented, Feb 3, 2021

Hello @komw ,

I was able to reproduce the behavior you are seeing, where the 2nd ad does not load if requestMode is let to "onLoad".

I will plan into looking into a built in solution, but for now the work-arounds you suggested seem to work.

In terms of the xml returned by the ad request, the plugin does not provide a way to view this, however, you should be able to see what is returned in the network tab of the browser developer console.

Thank you, Jackson IMA SDK DevRel

0reactions
komwcommented, Jun 17, 2021

Hi @Kiro705 Yes, we tried the preloading for adsRenderingSettings without success. Do you have opportunity to check what is going on with that bug?

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is the actual reason for putting onload before send in AJAX
I am new to JS and was learning XHR AJAX. What really confuses me is that why on earth we have to put...
Read more >
Request.mode - Web APIs - MDN Web Docs
This is used to determine if cross-origin requests lead to valid responses, and which properties of the response are readable.
Read more >
onload Event - W3Schools
The onload event occurs when an object has been loaded. onload is most often used within the <body> element to execute a script...
Read more >
Resource loading: onload and onerror
Errors that occur during the loading of the script can be tracked in an error event. For instance, let's request a script that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found