Open smelfungus opened 6 years ago
@DummyCo I have your use case covered here: Nested Demo. It is more complicated than usual, but the idea is straight-forward: you need to have your nested RV as a ToroPlayer, and inside that, do some manual stuff (where the demo show you how to deal with the hard work).
Oh, getPlayerView() is returning nested Container, got the point! Thank you.
Yeah. I should have put more comments though, but if you found any issue just let me know.
@eneim that works like a charm, thank you so much. During whole the development & testing process on last couple of days 4 crashes were spawned (I assume that's similar to #246). I'm still trying to investigate circumstances leading to that behavior if that's related to container-in-container solution and will open a new issue if that's needed:
Fatal Exception: java.lang.IllegalStateException: Player is playing while it is not in managed state: ViewHolder{d8048f9 position=7 id=412, oldPos=-1, pLpos:-1}
at im.ene.toro.widget.Container.onChildDetachedFromWindow(Container.java:181)
at android.support.v7.widget.RecyclerView.dispatchChildDetached(RecyclerView.java:6971)
at android.support.v7.widget.RecyclerView$5.removeViewAt(RecyclerView.java:770)
at android.support.v7.widget.ChildHelper.removeViewAt(ChildHelper.java:168)
at android.support.v7.widget.RecyclerView$LayoutManager.removeViewAt(RecyclerView.java:8067)
at android.support.v7.widget.RecyclerView$LayoutManager.removeAndRecycleViewAt(RecyclerView.java:8339)
at android.support.v7.widget.LinearLayoutManager.recycleChildren(LinearLayoutManager.java:1370)
at android.support.v7.widget.LinearLayoutManager.recycleViewsFromStart(LinearLayoutManager.java:1416)
at android.support.v7.widget.LinearLayoutManager.recycleByLayoutState(LinearLayoutManager.java:1485)
at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1509)
at android.support.v7.widget.LinearLayoutManager.scrollBy(LinearLayoutManager.java:1332)
at android.support.v7.widget.LinearLayoutManager.scrollVerticallyBy(LinearLayoutManager.java:1076)
at android.support.v7.widget.RecyclerView$ViewFlinger.run(RecyclerView.java:4864)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911)
at android.view.Choreographer.doCallbacks(Choreographer.java:723)
at android.view.Choreographer.doFrame(Choreographer.java:655)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
@DummyCo Sounds good (about that it works for you).
Here is the part throw the Exception. It is un-expected if the player is playing while Container doesn't manage it. I will try to reproduce this, but let's help by debugging if possible. Sorry I'm not super good at unit test :(.
@eneim unfortunately that's not reproducing stably and spawns on random coincidences while high main thread load cases with intensive Container populating/recycling. Will try to do my best on acquiring any additional information, thank you!
@DummyCo thanks. I also guess that this happen on nested RV, the case it is detached and the consequence after that. But let me also try the same case. It might be reproducible :D.
@eneim Any news about this issue, or any workaround?
Hi there! Are there any successful approaches of using toro in case when we're having RecyclerView with nested RecyclerView (or nested ViewPager) containing video views? It's still needed to play one video at time. Should it be implemented with multiple helpers per nested RecyclerView? How is it possible to pass all the ToroPlayer events from parent ViewHolder to nested ViewHolders and helpers? Thank you!