Open tlind15 opened 7 years ago
@tlind15 This case has been in my backlog for a while. To provide a good UX, it requires some tricks I think. Let me think a bit more about this case.
@eneim Thanks!!
@eneim I noticed that when I fling to the top or the bottom of the recycler the video that is visible prepares but doesn't start playback. Is there any fix
Please create a separated issue for your question with more info
Any idea on a workaround for this issue?
@aldocano sadly not yet. I spent a few hours looking around Overscroll API and it doesn't help. I will get back to this later when I could find a better way.
@eneim what do you suggest for a quick fix than, some view tweaks? Also how to not show black screen before playing videos?
fixed it with
@Override public boolean wantsToPlay() {
return ToroUtil.visibleAreaOffset(this, itemView.getParent()) >= 1;
}
Your solutions doesn’t look elegant to me enough, but it gives me a hint. Let me take a look.
I didnt find any other idea on how to solve it, what do you suggest?
My previous attempt is to ask Container if it reaches the bottom, the trigger the “reverse PlayerSelector” (that’s why there is that method). But it doesn’t work well.
What I’m thinking now is a dynamic way: pass a callback down to ViewHolder, the callback has the responsibility to tell the ViewHolder if it is the one on the bottom (so ViewHolder must be blind about it situation). The callback is triggered from the “wantsToPlay” and if you have reaches the bottom, all ViewHolder other than the bottom one must return false and the one on the bottom return true. Of course only when it is visible enough.
The callback is just an interface implemented by another class. I’m thinking about the Adapter or the host Activity.
A P/S: your code will not work if there are 2 or more ViewHolder those are fully visible. Also, if the list is infinited, I need a mechanism to handle the event your list is extended (data change callbacks). Will update here later what i can do.
I the moment of speaking i have 3 recyclerview items, it works. I dont know if some problems might occur if the list is longer. Maybe i might lower the visibleAreaOffset.
Can also help out on the black screen before playing video, is it exoplayer issue or toro's?
My recycler view contains only videos and the built in MOST_VISIBLE_TOP_DOWN strategy works for all of them except the very last video in the recycler view. Is there a way to simply extend the MOST_VISIBLE_TOP_DOWN strategy so that when the recycler view is at the very bottom the last video plays instead?