media icon indicating copy to clipboard operation
media copied to clipboard

Smooth transition to player (which is in an itemview) in the next activity contaning recyclerview

Open soorajlh opened this issue 1 year ago • 0 comments

I have a RecyclerView in first Fragment which has PlayerView to play videos from url at the appropriate visible position (& pauses when the visible view is away from the visible position).

From here, clicking in the video I start next activity (similar to instagram when we click a reel video in feed) which has RecyclerView with pagersnaphelper. Here I pass the clicked video's data, current position & added it the list so it continues playing from there. I add remaining videos from API to the list.

Initially, both pages have its own pool of Players. In Instagram Android when we click a video there is a small buffering in between, the app I am developing also had that. The requirement is to be without that & expects behaviour like in iOS Instagram where the video seamlessly goes to fullscreen without interruption.

To make it like that, I have assigned the clicked PlayerView's player to a global variable & in next activity adapter binding if position is 0 I assign the global Player instead of creating a new one. I applied shared element transition also, but still there is a bit of interruption when assigning the shared Player to a PlayerView in the itemview.

But I found that when the next activity has a single PlayerView there is no noticeable interruption, anything I can do to achieve same in PlayerView is in itemview?

soorajlh avatar Apr 16 '24 05:04 soorajlh