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

IMA not playing if not the first in RecyclerView #131

Open
loicsiret opened this issue Jan 6, 2021 · 7 comments
Open

IMA not playing if not the first in RecyclerView #131

loicsiret opened this issue Jan 6, 2021 · 7 comments
Milestone

Comments

@loicsiret
Copy link

loicsiret commented Jan 6, 2021

Hi,

It seems that ads are displayed only on the first visible video in recyclerView.

Imagine the following situation

Video A : state paused, kohiiCanStart = false , No AdTag
Video B : kohiiCanStart = false , No AdTag
Video C : kohiiCanStart = false , AdTag = "https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dskippablelinear&correlator="
Video D : kohiiCanStart = false , No AdTag

All theses video are in a Viewholder and all are displayed at the same time.

If I manualy start Video C, the Ad is not playing (but I received
AdEvent.AdEventType LOADED
AdEvent.AdEventType CONTENT_PAUSE_REQUESTED
AdEvent.AdEventType CONTENT_RESUME_REQUESTED
AdEvent.AdEventType ALL_ADS_COMPLETED)

If I scroll to make Video C the top Video in RecyclerView, the ad is playing well

@loicsiret loicsiret changed the title IMA in RecyclerView IMA in RecyclerView not playing if not the first Jan 6, 2021
@loicsiret loicsiret changed the title IMA in RecyclerView not playing if not the first IMA not playing if not the first in RecyclerView Jan 6, 2021
@eneim
Copy link
Owner

eneim commented Jan 7, 2021

Thanks, I will double check this later this weekend. Just tested with one video when working on this change >.<

(Also, I assume that you are using the 1.2.0 RC2, but if not, please also try with the 1.3.0 SNAPSHOT I commented in the other issue. I will send a fix to this SNAPSHOT later, and if it is Ok that fix will be cherry-pick to 1.2.0 and be released later this month)

@eneim eneim added this to the TODO milestone Jan 7, 2021
@loicsiret
Copy link
Author

I have the issue with 1.3.0 SNAPSHOT

thanks for checking ;)

@loicsiret
Copy link
Author

loicsiret commented Jan 7, 2021

Also, if you are looking at the ima integration.
Sometimes, if Kohii pause/restart (by scrolling out of screen) a video while the ad is playing, when restarted the ads is not resuming, the video content start instead
Note: I can reproduce only when the viewholder is completely put off the screen

@eneim
Copy link
Owner

eneim commented Jan 8, 2021

Sometimes, if Kohii pause/restart (by scrolling out of screen) a video while the ad is playing, when restarted the ads is not resuming, the video content start instead

It is a known issue and it is not trivial because of the implementation detail of IMA. I will double-check what I can do, or it can be done differently.

@eneim
Copy link
Owner

eneim commented Jan 11, 2021

@loicsiret Had a look today, I could make it work with the following prototype: https://github.com/eneim/kohii/compare/prototype/multiple-ads?expand=1

Some notes:

  • It seems that you cannot reuse PlayerView instance, but each Video needs to use one.
  • In this prototype, I prepare all the Videos as soon as possible (so using "preload = true" and "memoryMode" to be INFINITE). I didn't try all options yet, but you can try to adjust the memory setup and see if it works.
  • There is a bug when using Ad and "preload = true" (so you can see the change I made to the Bridge class in "prepare" method). I will try to wrap it as a bug fix later, but if you are Ok checking out the project for your test, please go ahead.

@loicsiret
Copy link
Author

hmm the preroll are playing on B as expected, but I got lag when creating the screen

@eneim
Copy link
Owner

eneim commented Jan 17, 2021

@loicsiret It is because it needs to create many things at once. Quite busy the last week, I will try a prototype that prepares the IMA properly but still keep the memory usage low soon.

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

No branches or pull requests

2 participants