googleads / videojs-ima

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

Call adsLoader and then run adsLoader.contentComplete() #823

Closed bernardlau closed 5 years ago

bernardlau commented 5 years ago

How do I call adsLoader and then run adsLoader.contentComplete()

Originally posted by @huangdaman in https://github.com/googleads/videojs-ima/issues/801#issuecomment-497634740

Was this ever fixed/implemented? I am currently trying to clean up the ad in order to have another set of ads to play for the video as suggested by SDK documentation.

I want to request ads using the same tag more than once, but I only get ads for my first request. How do I fix this? When you request ads more than once, you need to let the ad server know that these are legitimate requests, and not accidental duplicates. The SDK will do this for you with two quick API calls:

  1. Call destroy() on your AdsManager instance. This prevents any post-rolls from playing when you make the below call to contentComplete(). You'll get a new AdsManager when you make your next request.
  2. Call contentComplete() on your AdsLoader instance. This resets the SDK so the new ad request doesn't look like a duplicate of the previous one. After making the two calls above, you can call requestAds() on your AdsLoader instance to get another set of ads to play for your new video.
arnaudcasame commented 5 years ago

Hi @bernardlau,

Normally, you don't need to call the adsLoader.contentComplete(), the Videojs-IMA plugin does that for you automatically, the instruction is executed on this line. If you wanna force the adsLoader contentComplete call, you can do so by accessing the AdsLoader via the player.ima.controller.sdkImpl, the right example would be player.ima.controller.sdkImpl.adsLoader.contentComplete(). The case 801 was not an issue with the plugin that we had to fix, it was an implementation specific to the user's application. The ad server will prevent you from requesting the same ad repeatedly during same stream a work around would be to call contentComplete on the adsLoader and then request the ad again.

bernardlau commented 5 years ago

Thank you for the timely reply. Closing this ticket as question has been answered.

Cheers @arnaudcasame