Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resend AD request with "onLoad" requestMode #969

Open
komw opened this issue Feb 2, 2021 · 11 comments
Open

Resend AD request with "onLoad" requestMode #969

komw opened this issue Feb 2, 2021 · 11 comments
Assignees
Labels

Comments

@komw
Copy link

komw commented Feb 2, 2021

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?

@Kiro705
Copy link
Member

Kiro705 commented 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

@Kiro705 Kiro705 self-assigned this Feb 3, 2021
@komw
Copy link
Author

komw commented Feb 4, 2021

@Kiro705 it would be great, currently its not possible to implement waterfall model for IMA and prefetch the ads before play video.

@komw
Copy link
Author

komw commented Feb 4, 2021

@Kiro705 And related question (maybe it will work as workaround for this bug) -> its possible to reload whole videojs-ima plugin when aderror will happen? I've tried to reinitialize plugin using player.ima = new ImaPlugin(player, options); but its not working fine.

@Kiro705
Copy link
Member

Kiro705 commented Feb 4, 2021

No, currently there is not a method of reloading the entire plugin.

@komw
Copy link
Author

komw commented Feb 25, 2021

No, currently there is not a method of reloading the entire plugin.

What do you thing? Maybe it will be the best option to implement to fix that bug?

@Kiro705
Copy link
Member

Kiro705 commented Feb 25, 2021

Possibly, would that be better for your use-case than your work around of adding the play() function directly after the this.player.ima.requestAds()?

Could you explain the benefits of reloading the plugin in that case?

@komw
Copy link
Author

komw commented Feb 25, 2021

Possibly, would that be better for your use-case than your work around of adding the play() function directly after the this.player.ima.requestAds()?

Could you explain the benefits of reloading the plugin in that case?

I'll explain what I'm trying to do. My player is trying to prefetch AD, and after some time I'm trying to starts play AD with my video(and of course with that prefetched AD). What I'm trying to do, is to prefetch the AD when page is loading.

I don't know where exactly is the problem. Loading one AD with "onLoad" is working fine without any problems, and I'm able to execute play() after some time with this prefetched AD. But when any error appears with that AD, and when I'm trying to ask for another AD, the plugin(or framework) can't play that second AD for some reason.
Its strange, because I think that such waterfall model is very common on websites. Also prefetching ADs is very usefull for users because they dont need to wait for watching Ad/Video.

Reloading plugin -> it was my idea, maybe such workaround will help to fix that problem? I dont know where the exactly problem is. If it is in IMA framework (but I dont think so, because that methods "onLoad","onPlay" are related to the videojs-ima plugin) perhaps it won't help.
I suppose that problem is with videoJS-ima plugin, because reloading whole player on page, and asking for that secondary AD is working fine. But I dont think that reloading whole player with many plugins etc will be a good solution, so maybe only reloading the videoJS-ima plugin will be better option if you can't find where exactly the problem is.

What do you think about that?

@Kiro705
Copy link
Member

Kiro705 commented Feb 26, 2021

Hi @komw ,

Can you confirm that you are using adsRenderingSettings. as described in this IMA preloading guide?

I am not sure if this plugin has been updated to work with IMA preloading, but will plan on looking into it. I think there would be a preferable way to work with IMA preloading instead of creating a method of reloading the plugin.

@komw
Copy link
Author

komw commented 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?

@as5550
Copy link

as5550 commented Oct 26, 2023

Hi @Kiro705
i am trying to send ad request before video play and will serve ad if received and then the player will start playing.
When player is paused i am not able to see ad request in network tab although ima.requestAd() is firing also once player starts playing the requests can be seen in network tab

@Kiro705
Copy link
Member

Kiro705 commented Dec 27, 2023

Hello @as5550 and @komw ,

I think you can trigger loading an ad by adding the following code in response to Ads.prototype.init():

this.player.trigger('readyforpreroll');

Depending on your implementation, triggering this event may have other side effects, so I would recommend testing this change before implementing it in production.

Let me know if this works for you, and if the change is able to help prototype a more dev-friendly change we could make to support this use-case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants